• Post Reply Bookmark Topic Watch Topic
  • New Topic

Reading the Event Log  RSS feed

 
Neil Barton
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to write a program that reads the events in the windows event log. I have found some code that works and it seems great, apart from one thing, I can't get the subject details. What I mean is the descriptive line that appears at the top of the event. For example this event says " Initialization status for service objects." I want to be able to capture that and pass it on. If I look in the vwread variable in my code I can see the other details and print them out but I cannot get that bit. Anybody know where it might be. I've attached a doc showing the Event and the output from my code. It looks like it ought to be strings[0] but such a thing doesn't seem to exist!

Capture.PNG
[Thumbnail for Capture.PNG]
Event 1066
Capture2.PNG
[Thumbnail for Capture2.PNG]
Code output
 
Les Morgan
Rancher
Posts: 779
19
C++ Java MySQL Database Netbeans IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have not mentioned anything about the program you have found, so about all I can say is: here is a reference to the MS Event Log C/C++ interface

https://msdn.microsoft.com/en-us/library/windows/desktop/aa385780(v=vs.85).aspx

[Rob]Fixed the URL[/]
 
Neil Barton
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Les,
I got the code I'm using from here: http://code.dblock.org/2010/09/30/jna-reading-windows-event-log-entries-in-java.html
It works fine in as much as it gives me the eventid, time, machine etc but it doesn't give me the event summary. I had a look through as many examples as I could find similar to this and none of them show it, maybe it's not in there? I'm not sure how to use the c++ interface from within Java and cannot see the summary mentioned in there either. This is the code I am using which works as far as it goes.

 
Neil Barton
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I gave up. After looking at Jacob, jWmi, jawin and jinterop I sat back and thought about it. Best way to get information out of windows files is to use windows. A powershell script put together in about 20 minutes gets log file entries and stores them in a file in a readable format. It's a shame I can't do it all from Java and there has to be a file drop in the middle but I have to move on and I was getting nowhere with this, I don't think the summary information is in the EventLogRecord.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!