Store log files that a service appends while running.
Retain the logs across reboots.
Which directory is most appropriate?
/var contains changing runtime data, and persistent logs conventionally live under /var/log.
Detailed explanation
/etc/logIncorrect. /etc stores configuration, not changing log data.
Incorrect. /etc stores configuration, not changing log data.
/var/logCorrect. /var/log is the conventional location for persistent system and service logs.
Correct. /var/log is the conventional location for persistent system and service logs.
/usr/logIncorrect. /usr is primarily for shareable installed software and data.
Incorrect. /usr is primarily for shareable installed software and data.
/run/logIncorrect. /run holds transient runtime state and is not persistent across reboot.
Incorrect. /run holds transient runtime state and is not persistent across reboot.
Try it yourself
An example you can run in a temporary verification environment.
find /var/log -maxdepth 1 -printExpected result
システムのログ領域。権限により一部を読めない場合があるKey points
- Variable data
- /var/log
- Persistent logs
Notes
- Environment: FHS 3.0/Linux
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.