Find the file size of Windows logs(Event,security & system) Using TSQL script.

  • Hi,

    I need to find the file size of Windows logs(Application ,security & system) Using TSQL script.

    I have Both environments (MSSQL 2000 & 2005). I want to set the alert when these files grow beyond certain limit.

    I know that there is provision itself in it to overwrite the events, but still I want to set alerts on it using MSSQL.

    I have tried with code below.

    exec master.dbo.xp_instance_regread

    'HKEY_LOCAL_MACHINE'

    ,'SYSTEM\CurrentControlSet\Services\Eventlog\Application'

    ,'File'

    But its not working on every server I have, that is because of some AD issues (permission on the 'config' folder).

    Please let me know is there any other way to do the same.

    Thanks in advance.

    Regards,

    Sameer.

  • Hi,

    Any one have any solution/suggestion on this ?:doze:

  • it is interesting. it is possible to parse the event log from tsql as well.

  • The Windows Event Logs on any server can provide insight to potential and real problems. As a SQL Server Database

    Administrator, it is important to have knowledge of problems that exist outside of SQL Server as well as inside of SQL

    Server. At times hardware problems such as controller failures, may be logged in the Windows Event Logs prior to

    SQL Server reading a page from the database that is corrupt.

    There is no native method in SQL Server that can be used to monitor the System Event Logs. However, VBScript and

    WMI can be used to read the System Event Logs in a SQL Agent Job through a Operating System(cmdExec) job step.

    In SQL Server 2005 and 2008 it is also possible to use a WMI Data Reader in Integration Services as well as make use

    of CLR to allow easy access to the System Event Logs.

    http://www.codecomments.com/WSH/message462337.html

    [font="Comic Sans MS"]+++BLADE+++[/font]:cool:

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

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