Save every local0 priority to local file /var/log/app.log.
Which rsyslog line is appropriate?
rsyslog syntax places a selector before its action. local0.* selects every priority and the path is a local-file action.
Detailed explanation
local0.* /var/log/app.logCorrect. It writes all local0 messages to the local file.
*.local0 /var/log/app.logIncorrect. It reverses facility and priority.
local0.* @/var/log/app.logIncorrect. @ denotes remote forwarding and is not used before a local path.
/var/log/app.log local0.*Incorrect. The selector and action order is reversed.
Try it yourself
An example you can run in a temporary verification environment.
printf '%s
' 'local0.* /var/log/app.log' | awk '{print $1, $2}'Expected result
local0.* /var/log/app.logKey points
- Selector precedes action
- * selects every priority
- Path is a local-file action
Notes
- Environment: POSIX awk / 模擬設定のみ
- 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.