| 1 | General Logging |
| 2 | =============== |
| 3 | |
| 4 | **Syntax:** `log size:200k count:5` |
| 5 | |
| 6 | Log rotation for run/task/services using the `log` sub-option with |
| 7 | redirection to a log file. Global setting, applies to all services. |
| 8 | |
| 9 | The size can be given as bytes, without a specifier, or in `k`, `M`, |
| 10 | or `G`, e.g. `size:10M`, or `size:3G`. A value of `size:0` disables |
| 11 | log rotation. The default is `200k`. |
| 12 | |
| 13 | The count value is recommended to be between 1-5, with a default 5. |
| 14 | Setting count to 0 means the logfile will be truncated when the MAX |
| 15 | size limit is reached. |
| 16 | |
| 17 | Redirecting Output |
| 18 | ------------------ |
| 19 | |
| 20 | The `run`, `task`, and `service` stanzas also allow the keyword `log` to |
| 21 | redirect `stderr` and `stdout` of the application to a file or syslog |
| 22 | using the native `logit` tool. This is useful for programs that do not |
| 23 | support syslog on their own, which is sometimes the case when running |
| 24 | in the foreground. |
| 25 | |
| 26 | The full syntax is: |
| 27 | |
| 28 | log:/path/to/file |
| 29 | log:prio:facility.level,tag:ident |
| 30 | log:console |
| 31 | log:null |
| 32 | log |
| 33 | |
| 34 | Default `prio` is `daemon.info` and default `tag` is the basename of the |
| 35 | service or run/task command. |
| 36 | |
| 37 | Log rotation is controlled using the global `log` setting. |
| 38 | |
| 39 | **Example:** |
| 40 | |
| 41 | service log:prio:user.warn,tag:ntpd /sbin/ntpd pool.ntp.org -- NTP daemon |