如何通過特定的源,日期時間和類別讀取Windows事件日誌?通過特定的方式讀取Windows事件日誌來源
3
A
回答
0
您可以使用被稱爲「Log Parser」
你可以使用,檢查一旦安裝幫助文件:一個API談到
0
使用EventLog Class考慮額外的軟件。
事件日誌可以訪問或自定義 Windows事件日誌,它記錄關於重要的軟件 或硬件事件 信息。使用EventLog, 可以讀取現有日誌,將 條目寫入日誌,創建或刪除 事件源,刪除日誌,並且 對日誌條目做出響應。您還可以在創建事件 源時創建新的日誌 源。
+0
老兄,把一些示例代碼如何得到事件按來源過濾,我會投票。最希望你也有資格獲得新的正確答案 – ppumkin 2012-10-24 12:07:49
0
我知道這個問題是強大了,但我今天花了一個很好的協議的時間建立一個解決的辦法,所以我想我會分享:
Dim myEventLogEntryCollection As EventLogEntryCollection = New EventLog("Application", System.Environment.MachineName).Entries
Dim myEventLogEntryArray(myEventLogEntryCollection.Count - 1) As EventLogEntry
myEventLogEntryCollection.CopyTo(myEventLogEntryArray, 0)
Dim QueryLog As System.Linq.IQueryable(Of EventLogEntry) = myEventLogEntryArray.AsQueryable
QueryLog = QueryLog.Where(Function(i As EventLogEntry) i.Source = "MyParticularSourceName")
For Each Entry As EventLogEntry In QueryLog
'... your code goes here
Next
myEventLogEntryCollection = Nothing
myEventLogEntryArray = Nothing
希望它可以幫助別人!
相關問題
- 1. 用PHP讀取Windows事件日誌
- 2. 寫入/讀取到Windows事件日誌
- 3. 來讀取特定的Windows安全日誌
- 4. Windows源事件日誌中的Windows事件日誌中的超壓警告
- 5. 如何通過EnterpriseLibrary以編程方式讀取錯誤日誌?
- 6. 通過編程方式在黑莓中讀取日誌
- 7. 我如何寫事件源的Windows日誌事件
- 8. 通過SSH讀取實時日誌
- 9. Windows事件日誌與文本日誌
- 10. Windows應用程序日誌事件正在'錯過'用我的事件日誌
- 11. 使用企業庫讀取Windows事件日誌
- 12. 用C#讀取Windows事件日誌(Source!= ProviderName!= SourceName)
- 13. Windows事件日誌 - 如何註冊事件源?
- 14. 訂閱Windows事件日誌?
- 15. Windows窗體事件日誌
- 16. Windows事件日誌權限
- 17. 以高性能的方式查詢Windows事件日誌
- 18. Windows事件日誌 - 事件ID 0
- 19. 從遠程計算機讀取事件日誌而不通過憑據
- 20. 使用Python在日誌文件中讀取/寫入特定行
- 21. 在Python中讀取日誌文件並輸出特定文本
- 22. Powershell:過濾事件日誌
- 23. 登錄到dotNet Core時的Windows事件日誌源
- 24. 使用jna讀取windows日誌
- 25. 如何閱讀Windows服務的事件日誌
- 26. 如何閱讀沒有EventMessageFile的Windows事件日誌?
- 27. 創建新的事件日誌源
- 28. Log4j2獲取日誌事件
- 29. 如何從Windows事件查看器獲取特定應用程序的事件日誌
- 30. Sql Server事務日誌讀取器
使用日誌解析器的示例代碼將使您的答案極其有用。儘管我寧願使用內部System.Diagnostics來讀取日誌 - 其他人也許會覺得這很有用。如果你更新我會+1 – ppumkin 2012-10-24 12:10:07