Using findstr on SQL 2005 ERRORLOG file

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Teresa Masino

    Using findstr on SQL 2005 ERRORLOG file

    We have set up a couple of SQL Server 2005 systems and I have found
    that the format of the ERRORLOG files and the SQL Agent's log files
    are Unicode or some format that findstr cannot parse properly. "find"
    parses them fine, but it doesn't have the capabilities that I need --
    specifically, I can't search for multiple strings in one search.

    I see the checkbox on the SQL Agent's for "Write OEM File", but it is
    grayed out so I am not able to try checking that. I also don't know
    if that would affect the server's ERRORLOG file too or just the
    Agent's log file.

    So what am I missing? What is everyone else doing who is used to
    having scripts to parse these files looking for strings that indicate
    problems? Is there a server setting that will force it to go back to
    a plain ANSI text file format for log files? Is that a bad thing to
    do?

    Thanks in advance for any insight,
    Teresa Masino
  • Erland Sommarskog

    #2
    Re: Using findstr on SQL 2005 ERRORLOG file

    Teresa Masino (teresa.masino@ peninsula.org) writes:
    We have set up a couple of SQL Server 2005 systems and I have found
    that the format of the ERRORLOG files and the SQL Agent's log files
    are Unicode or some format that findstr cannot parse properly. "find"
    parses them fine, but it doesn't have the capabilities that I need --
    specifically, I can't search for multiple strings in one search.
    >
    I see the checkbox on the SQL Agent's for "Write OEM File", but it is
    grayed out so I am not able to try checking that. I also don't know
    if that would affect the server's ERRORLOG file too or just the
    Agent's log file.
    >
    So what am I missing? What is everyone else doing who is used to
    having scripts to parse these files looking for strings that indicate
    problems? Is there a server setting that will force it to go back to
    a plain ANSI text file format for log files? Is that a bad thing to
    do?
    I doubt there is a setting to force the SQL Server error log to be ANSI.
    Would be a lot problem to log object and database names with characters
    outside the ANSI set in that case.

    I guess the answer is to use Unicode-capable tools. I don't have any
    real suggestion for that. I search the errorlog fairly rarely, so most
    of the time I'm content of opening it in Textpad. (Which understands
    Unicode in so far it can handle the encoding, but it's not able to
    work with characters outside the ANSI range.)

    --
    Erland Sommarskog, SQL Server MVP, esquel@sommarsk og.se

    Books Online for SQL Server 2005 at

    Books Online for SQL Server 2000 at

    Comment

    • Dan.Cook@coxhealth.com

      #3
      Re: Using findstr on SQL 2005 ERRORLOG file

      On Feb 28, 11:12 am, Teresa Masino <teresa.mas...@ peninsula.org>
      wrote:
      We have set up a couple of SQL Server 2005 systems and I have found
      that the format of the ERRORLOG files and the SQL Agent's log files
      are Unicode or some format that findstr cannot parse properly.  "find"
      parses them fine, but it doesn't have the capabilities that I need --
      specifically, I can't search for multiple strings in one search.
      >
      I see the checkbox on the SQL Agent's for "Write OEM File", but it is
      grayed out so I am not able to try checking that.  I also don't know
      if that would affect the server's ERRORLOG file too or just the
      Agent's log file.
      >
      So what am I missing?  What is everyone else doing who is used to
      having scripts to parse these files looking for strings that indicate
      problems?  Is there a server setting that will force it to go back to
      a plain ANSI text file format for log files?  Is that a bad thing to
      do?
      >
      Thanks in advance for any insight,
      Teresa Masino
      The TYPE command will convert unicode to ASCII. i.e.

      TYPE \\coxsql2\E$\MS SQL.1\MSSQL\LOG \ERRORLOG \\coxsql2\C$\ER RORLOG
      \ErrorLog.txt

      Comment

      • Dan.Cook@coxhealth.com

        #4
        Re: Using findstr on SQL 2005 ERRORLOG file

        On Feb 28, 5:33 pm, Erland Sommarskog <esq...@sommars kog.sewrote:
        Teresa Masino (teresa.mas...@ peninsula.org) writes:
        We have set up a couple of SQL Server 2005 systems and I have found
        that the format of the ERRORLOG files and the SQL Agent's log files
        are Unicode or some format that findstr cannot parse properly.  "find"
        parses them fine, but it doesn't have the capabilities that I need --
        specifically, I can't search for multiple strings in one search.
        >
        I see the checkbox on the SQL Agent's for "Write OEM File", but it is
        grayed out so I am not able to try checking that.  I also don't know
        if that would affect the server's ERRORLOG file too or just the
        Agent's log file.
        >
        So what am I missing?  What is everyone else doing who is used to
        having scripts to parse these files looking for strings that indicate
        problems?  Is there a server setting that will force it to go back to
        a plain ANSI text file format for log files?  Is that a bad thing to
        do?
        >
        I doubt there is a setting to force the SQL Server error log to be ANSI.
        Would be a lot problem to log object and database names with characters
        outside the ANSI set in that case.
        >
        I guess the answer is to use Unicode-capable tools. I don't have any
        real suggestion for that. I search the errorlog fairly rarely, so most
        of the time I'm content of opening it in Textpad. (Which understands
        Unicode in so far it can handle the encoding, but it's not able to
        work with characters outside the ANSI range.)
        >
        --
        Erland Sommarskog, SQL Server MVP, esq...@sommarsk og.se
        >
        Books Online for SQL Server 2005 athttp://www.microsoft.c om/technet/prodtechnol/sql/2005/downloads/books...
        Books Online for SQL Server 2000 athttp://www.microsoft.c om/sql/prodinfo/previousversion s/books.mspx- Hide quoted text -
        >
        - Show quoted text -
        From a batch job the TYPE command will convert unicode to ASCII. i.e.

        TYPE \\SQLSRVR1\E$\M SSQL.1\MSSQL\LO G\ERRORLOG \\SQLSRVR1\C$\E RRORLOG
        \ErrorLog.txt

        Comment

        • rcamarda

          #5
          Re: Using findstr on SQL 2005 ERRORLOG file

          check out LOGPARSER available from Microsoft. It can be used to parse
          Active Directory and server event logs.
          I use it to load data directly into a SQL table :)
          HTH
          Rob

          Comment

          Working...