I need to save windows event logs in some file, now i am using:
var els = new EventLogSession();
els.ExportLogAndMessages("Application", PathType.LogName, "*", Path.Combine("c:\\Application.evtx"), false, CultureInfo.CurrentCulture);
this works fine but i want to get logs between DateTime
range, i suspect that 3rd parameter in ExportLogAndMessages
"query" may help me.
now how to write this "query", and if "query" doesn't help is there anyway to do that.
These links can help you to form your query:
You should compose a query to get events in some date range only.
I think you can use: TimeCreated parameter in your query.