GrepBoardLog

Drop log files anywhere

Files, whole folders and .gz archives. Or press Ctrl+V to paste text.

syslog: headers, priorities and kernel events

/var/log/messages and /var/log/syslog mix everything the machine has to say: daemons, cron, systemd, the kernel. During an incident the useful lines are a handful among thousands โ€” an OOM kill, a disk I/O error, a service that exited.

Drop the file on this page and the board shows the busiest programs, kernel and system events (OOM kills, segfaults, I/O errors, link up/down, time sync) on a timeline, and calls out OOM kills and disk I/O errors by host and device. The one-liners below do the same on the server.

Two header formats

RFC 3164 (BSD syslog)

The older, informational format, still what most files on disk look like:

<34>Oct 11 22:14:15 mymachine su: 'su root' failed for lonvick on /dev/pts/8
PartIn the exampleRules
PRI<34>Facility ร— 8 + severity, in angle brackets. Text files written by the local syslog daemon usually leave it out.
TIMESTAMPOct 11 22:14:15"Mmm dd hh:mm:ss", local time, 24-hour clock. No year, no time zone. Days below 10 are padded with a space: "Oct 7" has two spaces.
HOSTNAMEmymachineHost name, IPv4 or IPv6 address of the sender.
TAGsuProgram name, up to 32 alphanumeric characters; any other character ends it and starts CONTENT โ€” so the colon after su already belongs to CONTENT. A process id in brackets, as in sshd[3011]:, is common.
CONTENT'su root' failed โ€ฆFree text.

Because the day can be one or two characters with padding, awk field numbers stay the same ($1 month, $2 day, $3 time, $4 host, $5 tag) but fixed character positions do not line up for days 1โ€“9 unless you account for the padding. The missing year matters when a file spans New Year.

RFC 5424

The current standard adds a version, a full timestamp and structured data:

<165>1 2026-10-18T10:02:11.003Z web-1 app 4242 ID47 [exampleSDID@32473 iut="3"] request timed out
FieldIn the exampleRules
PRI<165>Same calculation. 165 = facility 20 (local4) ร— 8 + severity 5 (notice).
VERSION1Protocol version.
TIMESTAMP2026-10-18T10:02:11.003ZFull date and time with fractions and a zone, or "-".
HOSTNAMEweb-1Up to 255 characters, or "-".
APP-NAMEappUp to 48 characters, or "-".
PROCID4242Up to 128 characters, or "-".
MSGIDID47Up to 32 characters, or "-".
STRUCTURED-DATA[exampleSDID@32473 iut="3"]Zero or more [id name="value"] elements, or "-".
MSGrequest timed outThe message.

Facility and severity

PRI packs two numbers: PRI = facility ร— 8 + severity. So facility is int(PRI / 8) and severity is PRI % 8. <0> is kern.emerg; <165> is local4.notice.

SeverityName
0Emergency: system is unusable
1Alert: action must be taken immediately
2Critical
3Error
4Warning
5Notice: normal but significant
6Informational
7Debug
FacilityName
0kernel messages
1user-level
2mail
3system daemons
4security/authorization
5syslogd internal
6line printer
7network news
8UUCP
9clock daemon
10security/authorization
11FTP daemon
12NTP
13log audit
14log alert
15clock daemon
16โ€“23local0 โ€“ local7

Kernel and system events worth finding

The OOM killer writes two lines that matter: which task triggered it and which process it killed. From the kernel source (6.x):

Oct 18 10:02:11 web-1 kernel: java invoked oom-killer: gfp_mask=0x140cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP), order=0, oom_score_adj=0
Oct 18 10:02:11 web-1 kernel: Out of memory: Killed process 4242 (java) total-vm:8123456kB, anon-rss:6012344kB, file-rss:0kB, shmem-rss:0kB, UID:1001 pgtables:12345kB oom_score_adj:0
Oct 18 10:02:12 web-1 systemd[1]: app.service: Main process exited, code=killed, status=9/KILL
  • <task> invoked oom-killer: โ€” the task whose memory allocation failed. Not necessarily the one killed.
  • Out of memory: Killed process <pid> (<name>) โ€” the victim, with its virtual size and resident memory (anon-rss, file-rss, shmem-rss) at that moment. When the limit was a cgroup, the text begins with "Memory cgroup out of memory" instead.
  • The next lines are usually the service manager noticing: code=killed, status=9/KILL from systemd is the same event seen from the service side.

Other lines worth a timeline: segmentation faults (segfault at), block I/O errors (I/O error, dev sdb), file system errors, and NIC link changes. Their exact wording depends on the kernel version and driver, so search with a short, case-insensitive pattern rather than a full sentence.

Shell one-liners for syslog files

Run against a sample /var/log/messages in RFC 3164 style (no PRI) and a small RFC 5424 file. On systemd hosts, journalctl -k gives kernel messages and journalctl -o short prints lines in the same layout, so the same pipes work.

  • Which programs write the most lines (pid stripped).

    awk '{print $5}' messages | sed -E 's/\[[0-9]+\]//; s/:$//' | sort | uniq -c | sort -rn | head
  • Lines per host, when several servers log to one file.

    awk '{print $4}' messages | sort | uniq -c | sort -rn
  • How many processes the OOM killer killed.

    grep -cE '(Out of memory|Memory cgroup out of memory): Killed process' messages
  • Which process names were killed.

    grep -oE 'Killed process [0-9]+ \([^)]+\)' messages | awk '{print $4}' | tr -d '()' | sort | uniq -c | sort -rn
  • Which tasks triggered the OOM killer.

    grep -oE '[^ ]+ invoked oom-killer' messages | sort | uniq -c
  • Which programs crashed with a segfault.

    grep -oE '[^ ]+\[[0-9]+\]: segfault at' messages | cut -d[ -f1 | sort | uniq -c | sort -rn
  • How many lines mention an I/O error.

    grep -ciE 'i/o error' messages
  • Lines per minute โ€” bursts stand out.

    cut -c1-12 messages | uniq -c
  • Lines per host per hour.

    awk '{split($3, t, ":"); print $4, t[1] ":00"}' messages | sort | uniq -c
  • Which programs write lines with error, fail or timed out.

    grep -iE 'error|fail|timed out' messages | awk '{print $5}' | sed -E 's/\[[0-9]+\]//; s/:$//' | sort | uniq -c | sort -rn
  • RFC 5424: decode PRI into facility and severity.

    grep -oE '^<[0-9]+>' syslog5424.log | tr -d '<>' | awk '{print "facility", int($1/8), "severity", $1%8}' | sort | uniq -c
  • RFC 5424: lines per host and app name.

    awk '{print $3, $4}' syslog5424.log | sort | uniq -c | sort -rn

FAQ

What is the difference between RFC 3164 and RFC 5424?

RFC 3164 describes the older BSD format: PRI, a timestamp without year or zone, host and a free-form tag. RFC 5424 is the standard that replaced it: a version number, a full ISO-style timestamp with zone, separate app name, process id and message id fields, and structured data.

How do I get facility and severity from the PRI number?

Facility is the integer part of PRI divided by 8; severity is the remainder. <34> is facility 4 (security/authorization), severity 2 (critical).

Why is there no year in /var/log/messages?

The RFC 3164 timestamp format has none. Tools assume the current year, which goes wrong for files that cross New Year. RFC 5424 timestamps carry the year and zone.

How do I find what the OOM killer killed?

Search for "Out of memory: Killed process". The pid and process name follow, then its memory at the time. The line before it says which task invoked the OOM killer.

Why is the day sometimes followed by two spaces?

RFC 3164 pads days below 10 with a space, so "Oct 7" has two spaces. awk splits on runs of spaces and is not affected; cut -d" " is.

Can it read journald output?

Text exported with journalctl in the default short format has the same layout as a syslog file and can be dropped on the board. JSON export is read as JSON lines.

๐Ÿ”’ Nothing leaves your browser.

Your logs are parsed and counted right here, on your machine.