Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


pars event log for event typer = error email event info script help

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,58370
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> pars event log for event typer = error email event info script help
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1] 2   next >   >>
Login
Message << Older Topic   Newer Topic >>
 pars event log for event typer = error email event info... - 3/24/2008 1:42:54 PM   
  aron

 

Posts: 32
Score: 0
Joined: 10/31/2006
Status: offline

Hi All.
can anyone point me to the right direction to get a script running that will check the even logs via a scheduled task each morning so it will have to check the last 24hrs and look for any error type = Error then dump it to a text file so i can email it off.
here is something similar that i got off a site
the set number bit is what i cant seem to get correct or manipulate


      

this is what i tried but didnt work.



      

regards aron.
 
 
Post #: 1
 
 RE: pars event log for event typer = error email event ... - 3/24/2008 3:40:48 PM   
  dm_4ever


Posts: 2641
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
Filtering the returned event entries just requires you modifying the query.

In the example you posted it would be this line you need to modify: "Select * from Win32_NTLogEvent Where Logfile =" & strLogType

Add an "and" and then EventType='123' or whatever you're looking for...you can continue to filter in this manner.

Is this being executed on WinXP or better?

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to aron)
 
 
Post #: 2
 
 RE: pars event log for event typer = error email event ... - 3/24/2008 4:17:47 PM   
  aron

 

Posts: 32
Score: 0
Joined: 10/31/2006
Status: offline
Thanks Dm_4ever

yes the OS are SBS, 2003 servers..

thanks for your help.

(in reply to dm_4ever)
 
 
Post #: 3
 
 RE: pars event log for event typer = error email event ... - 3/24/2008 4:25:53 PM   
  aron

 

Posts: 32
Score: 0
Joined: 10/31/2006
Status: offline
hmm get an error



here is the lin with the error line 67 is the error


      


and here is the modified code that you asked me to change


      

and here is the full code ( for testing im running on xp pro)


      

appreciate your help..

(in reply to aron)
 
 
Post #: 4
 
 RE: pars event log for event typer = error email event ... - 3/25/2008 12:17:34 AM   
  ebgreen


Posts: 4971
Score: 31
Joined: 7/12/2005
Status: offline
EventType is an int not a string.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to aron)
 
 
Post #: 5
 
 RE: pars event log for event typer = error email event ... - 3/25/2008 12:31:23 AM   
  dm_4ever


Posts: 2641
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
Looks like it is:
http://msdn2.microsoft.com/en-us/library/aa394226(VS.85).aspx

So an error is actually 1 if you look at the WMI class.

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to ebgreen)
 
 
Post #: 6
 
 RE: pars event log for event typer = error email event ... - 3/26/2008 12:12:44 PM   
  aron

 

Posts: 32
Score: 0
Joined: 10/31/2006
Status: offline
oh cool thats working now thanks for that.

how do i go about only showing the last 24hrs from the time that the script runs..


so if i set it as a scheduled task to run at say 9am i wants to show the last 24 hours of logs from 9am..


cheers aron.

(in reply to dm_4ever)
 
 
Post #: 7
 
 RE: pars event log for event typer = error email event ... - 3/26/2008 1:37:19 PM   
  TomRiddle


Posts: 188
Score: 4
Joined: 2/7/2008
Status: offline
That is exactly the same bit I am working on in my latest script. (An event log reading script like this one)
I am having problems with it because it only checks the date if the event passes through the query string.
Ideally being able to put the date in to the query string as a filter would solve my problem.

I will post my script when i have got it completely working

(in reply to aron)
 
 
Post #: 8
 
 RE: pars event log for event typer = error email event ... - 3/26/2008 3:53:10 PM   
  dm_4ever


Posts: 2641
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
The reason I asked if you were doing this on WinXP or better is because there is an easy way to convert standard date/time to UTC with WinXP or better


      

So for your script you would add to your query Where TimeGenerated >= UTCTime (which you can get with the function above)....I believe you have all the information you need to accomplish your task now.

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to TomRiddle)
 
 
Post #: 9
 
 RE: pars event log for event typer = error email event ... - 3/26/2008 5:57:29 PM   
  TomRiddle


Posts: 188
Score: 4
Joined: 2/7/2008
Status: offline
I ended up getting mine working, the time check is still not in the actual query but it seems to work alright.



      

< Message edited by TomRiddle -- 3/26/2008 8:55:46 PM >

(in reply to dm_4ever)
 
 
Post #: 10
 
 RE: pars event log for event typer = error email event ... - 3/26/2008 9:00:45 PM   
  TomRiddle


Posts: 188
Score: 4
Joined: 2/7/2008
Status: offline
Thanks for that UTC date conversion script dm, it will be handy to know how to convert that way.

(in reply to dm_4ever)
 
 
Post #: 11
 
 RE: pars event log for event typer = error email event ... - 3/27/2008 4:49:37 AM   
  dm_4ever


Posts: 2641
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
Example:


      

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to TomRiddle)
 
 
Post #: 12
 
 RE: pars event log for event typer = error email event ... - 3/28/2008 2:32:52 PM   
  TomRiddle


Posts: 188
Score: 4
Joined: 2/7/2008
Status: offline
Thanks dm,
I will use that, though convert the date outside the main sub in the interests of script efficiency because my script may want to search back many days over thousands of event log entries.


      

EDIT:
Link to the final version of my script - uses dm_4ever's StdToUTCTime function and query syntax to save me looping through unnecessary logs.
http://www.visualbasicscript.com/fb.aspx?m=58499


< Message edited by TomRiddle -- 3/28/2008 9:29:58 PM >

(in reply to dm_4ever)
 
 
Post #: 13
 
 RE: pars event log for event typer = error email event ... - 3/30/2008 5:18:10 PM   
  aron

 

Posts: 32
Score: 0
Joined: 10/31/2006
Status: offline
sorry for the late reply

im gettng an error

line 74 ( thats the select statement line)
Wrong number of arguments or invalid property assignemnt: 'StdToUTCTime''

here is the select statment


      


an the full code


      

appreciate your help ... aron.

(in reply to TomRiddle)
 
 
Post #: 14
 
 RE: pars event log for event typer = error email event ... - 3/30/2008 9:34:48 PM   
  TomRiddle


Posts: 188
Score: 4
Joined: 2/7/2008
Status: offline
StdToUTCTime is a function and you are not passing anything to it in that line

Edit Note, dm_forever and I posted two different examples.

< Message edited by TomRiddle -- 3/30/2008 9:37:42 PM >

(in reply to aron)
 
 
Post #: 15
 
 RE: pars event log for event typer = error email event ... - 4/1/2008 11:08:01 AM   
  aron

 

Posts: 32
Score: 0
Joined: 10/31/2006
Status: offline
oh ok.

i think iv done it correctly now, but get another error to with the part of the script that writes the file.

here is the function


      

here is the select statment


      

and this is where the script errors althoe dosent give me what its falling over on just says error at line 80..

this is line 80


      

this is the entire part that spits out the file.


      

and full code


      

cheers aron

(in reply to TomRiddle)
 
 
Post #: 16
 
 RE: pars event log for event typer = error email event ... - 4/2/2008 12:17:55 AM   
  ebgreen


Posts: 4971
Score: 31
Joined: 7/12/2005
Status: offline
Are you certain that anything is being returned by the query?

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to aron)
 
 
Post #: 17
 
 RE: pars event log for event typer = error email event ... - 4/2/2008 3:42:44 PM   
  aron

 

Posts: 32
Score: 0
Joined: 10/31/2006
Status: offline

the script appears to run to the point where it creates the file then hangs on inserting the data into the file. but i don't get a error as in it dosen't tell me whats wrong, just says error and give a line reference.

cheers aron.

(in reply to ebgreen)
 
 
Post #: 18
 
 RE: pars event log for event typer = error email event ... - 4/3/2008 12:23:45 AM   
  ebgreen


Posts: 4971
Score: 31
Joined: 7/12/2005
Status: offline
Ok, there are some issues here around the file creation. I don't know that they are causing your problem, bu