Answer the question
In order to leave comments, you need to log in
Reading the event log, why are not all events read correctly?
I needed to read the system logs, for the experiment I used the following code:
EventLog myEventLog = new EventLog("System", "localhost");
int i = 0;
foreach (EventLogEntry entry in myEventLog.Entries)
{
richTextBoxLog.Text += "Category\n" + entry.Category + "\nCategoryNumber\n" +
entry.CategoryNumber + "\nEntryType\n" + entry.EntryType + "\nEventID\n" +
entry.EventID + "\nIndex\n" + entry.Index + "\nInstanceId\n" +
entry.InstanceId + "\nMachineName\n" + entry.MachineName +
"\nMessage\n" + entry.Message + "\nSource\n" + entry.Source;
i++;
if (i>10) break;
}
EventLog
text in the system log and the one received by the program is the same, for example Запущена служба журнала событий.
, but if the event source is, for example, Microsoft-Windows-Kernel-General
then the program receives the following event text:Не найдено описание для события с кодом '12' в источнике 'Microsoft-Windows-Kernel-General'. Возможно, на локальном компьютере нет нужных данных реестра или файлов сообщений DLL для отображения сообщений, либо у вас нет прав доступа к ним. В записи события содержится следующая информация:'10', '0', '17763', '1', '0', '0', '2019-02-17T12:23:00.500000000Z'
but if this event is viewed through the event log (eventvwr.msc), then we seeСистемное время запуска операционной системы: 2019-02-17T12:23:00.500000000Z.
Why and how to get the same text as in the event log?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question