通过 Java 在事件查看器中访问名为日期和时间的字段
Accessing field called Date and Time in Event Viewer through Java
我想通过 Java 从事件查看器访问名为日期和时间的字段。我设法获得了 EventID :
EVENTLOGRECORD record = new EVENTLOGRECORD(pevlr);
if (record.EventID.shortValue() == 4624) {
System.out.println("Successful log in: " + " Event ID: " + record.EventID.shortValue());
}
if (record.EventID.shortValue() == 4634) {
System.out.println("Successful log out: " + " Event ID: " + record.EventID.shortValue());
}
现在下一步就是获取 Date and time
如果有人能提供帮助,我将不胜感激!
与此同时,我弄清楚了如何获取日期和时间字段。刚用过:
long timestamp = record.TimeGenerated.longValue() * 1000;
Date d = new Date(timestamp);
我想通过 Java 从事件查看器访问名为日期和时间的字段。我设法获得了 EventID :
EVENTLOGRECORD record = new EVENTLOGRECORD(pevlr);
if (record.EventID.shortValue() == 4624) {
System.out.println("Successful log in: " + " Event ID: " + record.EventID.shortValue());
}
if (record.EventID.shortValue() == 4634) {
System.out.println("Successful log out: " + " Event ID: " + record.EventID.shortValue());
}
现在下一步就是获取 Date and time
如果有人能提供帮助,我将不胜感激!
与此同时,我弄清楚了如何获取日期和时间字段。刚用过:
long timestamp = record.TimeGenerated.longValue() * 1000;
Date d = new Date(timestamp);