Jump to content

Count Windows EventLog entries for last hour


Recommended Posts

Hi,

I'd like to make a script that counts the number of log entires in the Windows Application Log, System log and Security Log for the last hour only. I'm then going to pass that to another tool which graphs. Usually the number of entries will be 0 or just a few. If there are hundreds or thousands of them, then I know I have an issue I need to look at.

I found _EventLog__Count but it doesn't let me get the data for just the last hour. I know I can store the last result in a variable and compare it hour to hour. That would be OK, but then if the log is cleared or my app doesn't run for a while, it gets screwy. Better would be something discrete that just counts for the last hour and returns that number.

Any suggestions? Can _EventLog__Count be modified to take a date?

Any help or best, sample code, much appreciated!

Mark

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...