How to Export error log (filter on specific errors) as a job

  • Hi all,

    I want to export specific errors from the error log as a text file, and automate this as a job, as in:

    if there's Error: 523 or Error: 1011, etc, export those rows. Unfortunately there's no more syslogs table

    I know I can export the whole log manually (Right-click on log, export), but how can I do that in sql from a job?

    Thanks a bunch

     

  • creaet a SP to use xp_readerrorlog to load the errorlog file into a table, filter it and export it.

  • thanks allen

  • Try on code similar like this

    CREATE TABLE #errors

    (errorlog varchar(255), continuationrow int)

    INSERT #errors

    (errorlog, continuationrow)

    EXEC xp_readerrorlog

    SELECT errorlog

    FROM #errors WHERE errorlog LIKE '%Login failed%'

    DROP TABLE #errors

    Sivaprasad S - [ SIVA ][/url]http://sivasql.blogspot.com/[/url]

  • You can also use the Log Parser exe file. It's free download from microsoft and it has so many usages. You can also use it for the event viewer logs and many other logs and other data format as well

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply