Match text in logfile RRS feed

  • Question

  • I have string which divided into two consecutive likes I have to match count of "not found in XML!" Here from below pattern

    I am not getting success using select string, I have try to take search text in below variable

    $a=@("not`r`nError {dd-MMM-yyyy HH:MM:as}  found in XML!  -f get-date) it gives error about get date pattern for below lines in log, how to give search text $a


    "Error 12-JAN-2020 10:23:33   found in XML!"

    Wednesday, January 22, 2020 4:51 PM

All replies

  • There's no chance for any one to understand what you're actually asking for.

    You're member for more than 10 years and your post is lacking almost everything essential - the relevant code, the complete error message and some example data to be able to reproduce your issue.  And please format your code as code ... How to Use the Code Feature in a TechNet Forum Post.

    Live long and prosper!


    Wednesday, January 22, 2020 5:41 PM
  • I'm going to take a wild guess as to what you're trying to do:

    $a=@("not`r`nError {0} found in XML!" -f (get-date -Format "dd-MMM-yyyy HH:MM:ss" ))

    You need to surround the "get-date" within parenthesis for Powershell to parse it properly.

    You were missing the closing double-quote after "XML!".

    Your date format was incorrect, too. You have "as" where you should have "ss".

    I have no idea why you've made the variable "$a" into an array of just one string. Was that intentional?

    --- Rich Matheisen MCSE&I, Exchange Ex-MVP (16 years)

    Wednesday, January 22, 2020 9:25 PM
  • Hi,

    Was your issue resolved?

    If you resolved it using our solution, please "mark it as answer" to help other community members find the helpful reply quickly.

    If you resolve it using your own solution, please share your experience and solution here. It will be very beneficial for other community members who have similar questions.

    If no, please reply and tell us the current situation in order to provide further help.

    Best Regards,


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Monday, January 27, 2020 8:46 AM