Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Eventlog beschreibung auslesen

Empfohlene Antworten

Veröffentlicht

Hallo,

ich zapfe mit meinem c prog das eventlog von Windows an.

folgenden code habe ich bei MS gefunden:


#include <windows.h>
#include <stdio.h>

#define BUFFER_SIZE 1024*64

void DisplayEntries( )
{
HANDLE h;
EVENTLOGRECORD *pevlr;
BYTE bBuffer[BUFFER_SIZE];
DWORD dwRead, dwNeeded, dwThisRecord;

// Open the Application event log.

h = OpenEventLog( NULL, // use local computer
"Application"); // source name
if (h == NULL)
{
printf("Could not open the Application event log.");
return;
}

pevlr = (EVENTLOGRECORD *) &bBuffer;

// Get the record number of the oldest event log record.

GetOldestEventLogRecord(h, &dwThisRecord);

// Opening the event log positions the file pointer for this
// handle at the beginning of the log. Read the event log records
// sequentially until the last record has been read.

while (ReadEventLog(h, // event log handle
EVENTLOG_FORWARDS_READ | // reads forward
EVENTLOG_SEQUENTIAL_READ, // sequential read
0, // ignored for sequential reads
pevlr, // pointer to buffer
BUFFER_SIZE, // size of buffer
&dwRead, // number of bytes read
&dwNeeded)) // bytes in next record
{
while (dwRead > 0)
{
// Print the record number, event identifier, type,
// and source name.

printf("%03d Event ID: 0x%08X Event type: ",
dwThisRecord++, pevlr->EventID);

switch(pevlr->EventType)
{
case EVENTLOG_ERROR_TYPE:
printf("EVENTLOG_ERROR_TYPE\t ");
break;
case EVENTLOG_WARNING_TYPE:
printf("EVENTLOG_WARNING_TYPE\t ");
break;
case EVENTLOG_INFORMATION_TYPE:
printf("EVENTLOG_INFORMATION_TYPE ");
break;
case EVENTLOG_AUDIT_SUCCESS:
printf("EVENTLOG_AUDIT_SUCCESS\t ");
break;
case EVENTLOG_AUDIT_FAILURE:
printf("EVENTLOG_AUDIT_FAILURE\t ");
break;
default:
printf("Unknown ");
break;
}

printf("Event source: %s\n",
(LPSTR) ((LPBYTE) pevlr + sizeof(EVENTLOGRECORD)));

dwRead -= pevlr->Length;
pevlr = (EVENTLOGRECORD *)
((LPBYTE) pevlr + pevlr->Length);
}

pevlr = (EVENTLOGRECORD *) &bBuffer;
}

CloseEventLog(h);
}
[/PHP]

man kann also so ziemlich alle infos eines logeintrages anzeigen lassen, nur nicht den beschreibenden text.

also nur ID, type und source.

ich hätte jetzt gerne noch den beschreibenden text eines eintrages.

ich habe auch schon überall gesucht aber so richtig schlau bin ich da nicht geworden. das hängt irgendwie am dataoffset.

hat da jemand eine ahnung von?

hallo,

ich habe nochmal dran rumgebastelt:


if ( dwNumStrings = pevlr->NumStrings )
{
pStr = (LPBYTE)pevlr + pevlr->StringOffset;
}
if(pStr)
{
DWORD i;
printf("MessageText:\n");
for ( i = 0; i < dwNumStrings; i++ )
{
sprintf(tmp_message, "%s", pStr);
strcpy(message, tmp_message);
int tmp_len = strlen((char*)pStr);
tmp_len += 1;
pStr +=tmp_len;
}
printf("%s\n", message);
}
[/PHP]

Ausgabe Beispiel mit allen ausgelesenen daten::

Event ID: 0x40FF03E9

EventType: EVENTLOG_INFORMATION_TYPE

Event source: SNMP

MessageText:

Uniprocessor Free

Auszug aus EventLog des selben ausgelesenen eintrages:

Ereignistyp: Informationen

Ereignisquelle: SNMP

Ereigniskategorie: Keine

Ereigniskennung: 1001

Datum: 25.03.2004

Zeit: 06:36:01

Benutzer: Nicht zutreffend

Computer: 1121-UDANIEL

Beschreibung:

Der SNMP-Dienst wurde gestartet.

also lese ich Uniprocessor Free aus im eventlog steht aber das der dienst gestartet wurde.

ist das eine darstellung von EventLog oder lese ich falsch aus?

es kann ja sein das der eventlog viewer das noch einmal "übersetzt".

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.