How do I access the system logs in current versions of Raspbian? Where are these logs stored?
4 Answers
Raspbian comes with systemd. I prefer to use this progressive system. Systemd has a consistent journaling with journalctl with no need to know where log files are stored. But to answer your question if you also like to use journald, this is stored in /var/log/journal. For enabling persistent logging in journald and get access to it you have [1]:
To enable persistent logging, create /var/log/journal:
mkdir -p /var/log/journal systemd-tmpfiles --create --prefix /var/log/journalsystemd will make the journal files owned by the "systemd-journal" group and add an ACL for read permissions for users in the "adm" group. To grant a user read access to the system journal, add them to one of the two groups.
This will allow you to look at previous boot logs with e. g. "journalctl -b -1".
If you enable persistent logging, consider uninstalling rsyslog or any other system-log-daemon, to avoid logging everything twice.
Some examples how to get log "files": get last boot log
journalctl -b
Get kernel logging (was dmesg)
journalctl -k
Get continous showing log (as taken with tail -f on old style logs)
journalctl -f
Get log from the end with many details
journalctl -xe
Or get details from services, e.g. network
systemctl status systemd-networkd
# or
systemctl status networking
Try it. This already works with current logging. You do not need to have it persistent. But if you want a history you should make it persistent of course.
References:
[1] /usr/share/doc/systemd/README.Debian.gz
I'm running Linux raspberrypi 4.14.98-v7+ and I can access system logs by running:
tail -f /var/log/syslog
- 163
- 1
- 4
Depends on the operating system you are using.
Raspbian puts most logs in directory /var/log.
- 71,852
- 5
- 76
- 108
Which log file? There are many. Most of the log files are in /var/log.
However, there is a command called "dmesg" which allows you to read the kernel ring buffer (the kernel log). This will often tell you things that might have gone wrong with the boot sequence and is the most useful thing I've found to find out what is wrong.
I often use it as "dmesg | tail" or "dmesg | more"
- 1,580
- 10
- 10