.net - Windows, C#: reading eventlog entries from active AND saved logs -


i know can read security logs of windows pc using:

var securitylog = new eventlog("security"); foreach (eventlogentry entry in securitylog.entries) {     ... } 

the entry item contains interesting log fields expect see like: instanceid, message , others. want read same things event log saved disk .evtx file.

i have seen suggestions using

string xpathquery = "*";  var eventsquery = args.length == 0     ? new eventlogquery("security", pathtype.logname, xpathquery)     : new eventlogquery(args[0], pathtype.filepath, xpathquery);  using (var eventlogreader = new eventlogreader(eventsquery)) {     eventlogrecord entry;      while ((entry = (eventlogrecord) eventlogreader.readevent()) != null) {         ...     } } 

but entry in second version doesn't contain same members/values first example. totally dig confused , looking @ problem wrong way.

how should 1 go reading actual per record content either active or saved system log?

or, can go eventlogrecord eventlogentry? have not seen conversion method yet.


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -