10
- 특정 이벤트 (주어진 이벤트 ID, 시간 및 입력 노드)가 기록되는지 여부를 아는 방법? 예에 대한
, 내가 원하는 등등 로그인 이름, 내가 이벤트 설명과 같은 세부 사항을 얻는 방법 이벤트가 기록되어있는 경우 C# : 주어진 이벤트 ID로 이벤트 로그 세부 정보를 쿼리하는 방법?
, 내가 원하는 등등 로그인 이름, 내가 이벤트 설명과 같은 세부 사항을 얻는 방법 이벤트가 기록되어있는 경우 C# : 주어진 이벤트 ID로 이벤트 로그 세부 정보를 쿼리하는 방법?
새 스타일 Windows EventLog에서 이벤트를 쿼리하는 경우 몇 가지 새로운 트위스트가 있습니다.
이 샘플은 몇 가지 새로운 액세스 방법 인 건배를 보여줍니다.
string eventID = "5312";
string LogSource = "Microsoft-Windows-GroupPolicy/Operational";
string sQuery = "*[System/EventID=" + eventID + "]";
var elQuery = new EventLogQuery(LogSource, PathType.LogName, sQuery);
var elReader = new System.Diagnostics.Eventing.Reader.EventLogReader(elQuery);
List<EventRecord> eventList = new List<EventRecord>();
for (EventRecord eventInstance = elReader.ReadEvent();
null != eventInstance; eventInstance = elReader.ReadEvent())
{
//Access event properties here:
//eventInstance.LogName;
//eventInstance.ProviderName;
eventList.Add(eventInstance);
}
당신은 문제의 이벤트 로그를 조회 할 수 다음 Entries
컬렉션 매우 큰 경향이 있기 때문에
var sourceName = "MySource";
var el = new EventLog("Application");
var latestEntryTime = (from entry in el.Entries.Cast<EventLogEntry>()
where entry.Source == sourceName
&& // put other where clauses here...
orderby entry.TimeWritten descending
select entry).First();
그러나,이 방법은
느린 있음을 경고.
감사 Kellie는 .. 그것은 어떻게 주어진 날짜 withing에 이벤트를 얻기에 관하여 – satya
도움이? Microsoft Office 15 Alerts \ ") 및"+ // "(EventID = 300)"+ "(TimeCreated/@ SystemTime > = \ "+ t1 +"\ ")"+ "(TimeCreated/@ SystemTime < = \" "+ t2 +"\ ")"+ " "]] "; 쿼리 예외가 발생합니다. –