• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Reading the Event Log

 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 1059
27
Netbeans IDE Oracle MySQL Database Tomcat Server C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
The harder I work, the luckier I get. -Sam Goldwyn So tiny. - this ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic