ProblemYou want to find the size of an event log. This can help you determine how large an event log is and if you are close to reaching the maximum size (and therefore will start dropping events). SolutionUsing a graphical user interface
Using a command-line interfaceThis command displays the file size for all of the event logs that are stored in the default location on the file system: > dir %systemroot%\system32\config\*evt Using VBScript' This code displays the size of the specified event log in KB ' ------ SCRIPT CONFIGURATION ------ strLog = "<LogName>" ' e.g. Security strComputer = "<ComputerName>" ' e.g. wks01 (use "." for local machine) ' ------ END CONFIGURATION --------- set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") set colLogs = objWMI.ExecQuery("Select * from Win32_NTEventlogFile Where " & _ Logfilename = '" & strLog & "'") if colLogs.Count > 1 then WScript.Echo "Fatal error. Number of logs found: " & colLogs.Count WScript.Quit end if for each objLog in colLogs WScript.Echo strLog & " size: " & objLog.FileSize / 1024 & "KB" next DiscussionEach event log has a corresponding event log file, which contains all of the event log messages. The size of an event log is determined by viewing the size of its event log file. By default, the %systemroot%\system32\config\ directory contains these files. Each file name directly corresponds to the name of the event log that uses it with an .evt extension (e.g., Application.evt). See AlsoRecipe 16.5 for setting the maximum size of an event log |