brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: journalctl -t sudo lists who ran which command with sudo

Journalctl
~/tips/tip-journalctl-identifier-sudo-audit

journalctl -t sudo --since today

Filters the journal by program name, for example to review every sudo command.

On a shared box I like a quick answer to who did what as root.

journalctl -t sudo --since today
journalctl -t sshd -p warning

-t (--identifier) filters by the syslog identifier, which is the program name that wrote the line. Sudo logs each command with the user, the working directory and the command line. The second example shows warnings from the SSH daemon. Reading the system journal needs root or membership of the systemd-journal or adm group. Depending on the distribution, the sshd identifier can be ssh. Use journalctl -F SYSLOG_IDENTIFIER to list the available names.

Further reading: journalctl manual page

More Journalctl tips journalctl -k -g 'killed process' --since "2 days ago" journalctl _PID=1 -b ls -lh /var/log/journal/*/*.journal~ Storage=volatile sudo journalctl --setup-keys All Journalctl tips (81) All topics

Link