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.
Correct. It writes all local0 messages to the local file.
*.local0 /var/log/app.logIncorrect. It reverses facility and priority.
Incorrect. It reverses facility and priority.
local0.* @/var/log/app.logIncorrect. @ denotes remote forwarding and is not used before a local path.
Incorrect. @ denotes remote forwarding and is not used before a local path.
/var/log/app.log local0.*Incorrect. The selector and action order is reversed.
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
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.