The following is the GNU All-permissive License as recommended in https://www.gnu.org/licenses/license-recommendations.en.html

Copyright (C) 2024 Free Software Foundation sysadmin@fsf.org

Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty.

Contributions are welcome. See https://savannah.gnu.org/maintenance/fsf/.

using journalctl

Here is some documentation for journalctl that should make your life much easier. The fact that it uses binary logs means that you can filter and query those logs with commands. This allows you to show all kernel and dmesg logs that are 'error' or above, add time filters, or query a few service logs simultaneously while ignoring everything else. Using journalctl is much more powerful than looking at syslog with a text editor. You can also combine journalctl with grep, just like any other tool.

commands

Print everything

journalctl

Start at the end. iank: I almost always add this

Journalctl -e

Kernel / dmesg logs from this boot, 'err' level and above

journalctl -b 0 -k -p err

Interleaved apache and php-fpm logs from previous boot, at level 'info' or above. Using multiple '-u' options is useful for diagnosing errors related to interactions between processes.

journalctl -b -1 -u apache2 -u php-fpm -p info

All logs in time window, level 'err' and above

journalctl --since 2020-04-13 --until "1 hour ago" -p err

All logs from pid 1024. This is not as comprehensive as filtering by service name, because services also include child processes.

journalctl _PID=1024

Logs for comamnds run via bash

journalctl /bin/bash

Print last 100 lines of journal

journalctl -n 100

Follow journalctl output

journalctl -f

There are also commands for limiting journal file sizes on disk, and for formatting data as json, etc. (source for most of these commands)