Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
| docs:guide-user:base-system:log.essentials [2023/09/23 13:19] – [Logrotate] update vgaetera | docs:guide-user:base-system:log.essentials [2024/06/02 06:30] – [logread] stokito | ||
|---|---|---|---|
| Line 55: | Line 55: | ||
| ===== logd ===== | ===== logd ===== | ||
| - | '' | + | '' |
| + | It also listens for ''/ | ||
| + | It' | ||
| - | < | + | < |
| - | / | + | service |
| - | / | + | service |
| </ | </ | ||
| Line 70: | Line 72: | ||
| ==== logread ==== | ==== logread ==== | ||
| - | This is the default interface | + | This is the default interface |
| - | It is a local executable that will read the ring buffer records and display them chronologically. | + | |
| + | It is a local executable | ||
| + | |||
| + | To show all log messages that contains a specific text (like a daemon name) and follow (like in '' | ||
| + | <code bash> | ||
| + | logread -fe firewall | ||
| + | </ | ||
| + | |||
| + | Options: | ||
| + | < | ||
| + | -s < | ||
| + | -l < | ||
| + | -e < | ||
| + | -r < | ||
| + | -F < | ||
| + | -S < | ||
| + | -p < | ||
| + | -h < | ||
| + | -P < | ||
| + | -z < | ||
| + | -Z < | ||
| + | -f Follow log messages | ||
| + | -u Use UDP as the protocol | ||
| + | -t Add an extra timestamp | ||
| + | -0 Use \0 instead of \n as trailer when using TCP | ||
| + | </ | ||
| + | |||
| + | Please note that if you install the [[: | ||
| + | |||
| ==== Local file logging ==== | ==== Local file logging ==== | ||
| Line 107: | Line 138: | ||
| </ | </ | ||
| - | and then reload the rules using '' | + | and then reload the rules using '' |
| For the LAN-side station/ | For the LAN-side station/ | ||
| Line 143: | Line 174: | ||
| * ''/ | * ''/ | ||
| * '' | * '' | ||
| - | * restart it using '' | + | * restart it using '' |
| ===== Logrotate ===== | ===== Logrotate ===== | ||
| - | To automatically manage large collections of daily, weekly, or monthly logs, you may want to use [[:packages: | + | To automatically manage large collections of daily, weekly, or monthly logs, you may want to use [[packages: |
| - | Here' | + | Here' |
| <code bash> | <code bash> | ||
| Line 158: | Line 189: | ||
| uci set system.@system[0].log_remote=" | uci set system.@system[0].log_remote=" | ||
| uci commit system | uci commit system | ||
| - | / | + | service |
| # Configure logrotate | # Configure logrotate | ||
| cat << " | cat << " | ||
| include / | include / | ||
| - | |||
| / | / | ||
| - | # Rotate log files daily. | ||
| daily | daily | ||
| - | | ||
| - | # Keep 1 week worth of logs. | ||
| rotate 1 | rotate 1 | ||
| - | | ||
| missingok | missingok | ||
| notifempty | notifempty | ||
| Line 176: | Line 202: | ||
| service log restart | service log restart | ||
| sleep 1 | sleep 1 | ||
| - | logger -p warn -s "Log rotation complete." | + | logger -p warn -s "Log rotation complete" |
| endscript | endscript | ||
| } | } | ||
| Line 185: | Line 211: | ||
| 58 23 * * * logrotate / | 58 23 * * * logrotate / | ||
| EOF | EOF | ||
| - | / | + | service |
| # Debugging | # Debugging | ||
| Line 206: | Line 232: | ||
| </ | </ | ||
| + | If you add to the rsyslog receiver' | ||
| + | |||
| + | < | ||
| + | $template DynamicFile,"/ | ||
| + | *.* -? | ||
| + | </ | ||
| + | you get the messages separated from every sender in a own folder. | ||
| ===== rsyslog and Logz.io ===== | ===== rsyslog and Logz.io ===== | ||
| You can support logging direct to a cloud ELK provider like Logz.io by adding a few lines to your '' | You can support logging direct to a cloud ELK provider like Logz.io by adding a few lines to your '' | ||