Filter journal entries produced by nginx.service.
Which command is appropriate?
journalctl -u UNIT filters entries associated with a systemd unit.
Detailed explanation
journalctl -u nginx.serviceCorrect. -u nginx.service selects the unit's journal entries.
journalctl -t nginx.serviceIncorrect. -t filters a syslog identifier.
journalctl -p nginx.serviceIncorrect. -p selects priority.
journalctl -k nginx.serviceIncorrect. -k selects kernel messages.
Try it yourself
An example you can run in a temporary verification environment.
journalctl --help | grep -E -- '-u|--unit' | head -n 1Expected result
unit filterのhelp行Key points
- -u selects a unit
- -t selects an identifier
- Multiple -u filters are possible
Notes
- Environment: systemd journalctl help / journal読取なし
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Syslog facility and priority
Metadata that classifies a message source and its severity.
Journal persistence
Whether systemd journal data survives a reboot and where it is stored.
Log rotation
A process that retains, renames, compresses, or removes log generations.