jan kaufman | 28d7d89 | 2015-12-04 21:36:59 +0100 | [diff] [blame] | 1 | |
| 2 | ================================== |
| 3 | rsyslog |
| 4 | ================================== |
| 5 | |
| 6 | In computing, syslog is a widely used standard for message logging. It permits separation of the software that generates messages, the system that stores them, and the software that reports and analyzes them. |
| 7 | |
| 8 | Sample pillars |
| 9 | ============== |
| 10 | |
jan kaufman | 1a4044c | 2016-03-10 18:51:58 +0100 | [diff] [blame] | 11 | Rsyslog service with default logging template |
| 12 | |
| 13 | .. code-block:: yaml |
| 14 | |
| 15 | rsyslog: |
| 16 | client: |
| 17 | enabled: true |
| 18 | |
| 19 | |
| 20 | Rsyslog service with precise timestamps, severity, facility. |
jan kaufman | 28d7d89 | 2015-12-04 21:36:59 +0100 | [diff] [blame] | 21 | |
| 22 | .. code-block:: yaml |
| 23 | |
| 24 | rsyslog: |
| 25 | client: |
| 26 | enabled: true |
| 27 | format: |
| 28 | name: TraditionalFormatWithPRI |
jan kaufman | 1a4044c | 2016-03-10 18:51:58 +0100 | [diff] [blame] | 29 | template: '"%syslogpriority% %syslogfacility% %timestamp:::date-rfc3339% %HOSTNAME% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n"' |
Swann Croiset | 100028b | 2017-03-15 11:58:48 +0100 | [diff] [blame] | 30 | output: |
jan kaufman | 91532f9 | 2016-03-31 13:45:02 +0200 | [diff] [blame] | 31 | file: |
| 32 | -/var/log/syslog: |
| 33 | filter: *.*;auth,authpriv.none |
| 34 | owner: syslog |
| 35 | group: adm |
| 36 | createmode: 0640 |
| 37 | umask: 0022 |
| 38 | /var/log/auth.log: |
| 39 | filter: auth,authpriv.* |
| 40 | owner: syslog |
| 41 | group: adm |
| 42 | createmode: 0640 |
| 43 | umask: 0022 |
| 44 | -/var/log/kern.log: |
| 45 | filter: kern.* |
| 46 | owner: syslog |
| 47 | group: adm |
| 48 | createmode: 0640 |
| 49 | umask: 0022 |
| 50 | -/var/log/mail.log: |
| 51 | filter: mail.* |
| 52 | owner: syslog |
| 53 | group: adm |
| 54 | createmode: 0640 |
| 55 | umask: 0022 |
| 56 | /var/log/mail.err: |
| 57 | filter: mail.err |
| 58 | owner: syslog |
| 59 | group: adm |
| 60 | createmode: 0640 |
| 61 | umask: 0022 |
| 62 | ":omusrmsg:*": |
| 63 | filter: *.emerg |
| 64 | "|/dev/xconsole": |
| 65 | filter: "daemon.*;mail.*; news.err; *.=debug;*.=info;*.=notice;*.=warn": |
Swann Croiset | 100028b | 2017-03-15 11:58:48 +0100 | [diff] [blame] | 66 | -/var/log/your-app.log: |
| 67 | filter: "if $programname startswith 'your-app' then" |
| 68 | owner: syslog |
| 69 | group: adm |
| 70 | createmode: 0640 |
| 71 | umask: 0022 |
| 72 | stop_processing: true |
jan kaufman | 1a4044c | 2016-03-10 18:51:58 +0100 | [diff] [blame] | 73 | |
Swann Croiset | 01b2577 | 2017-03-16 09:18:01 +0100 | [diff] [blame] | 74 | Custom templates |
| 75 | ================ |
| 76 | |
| 77 | It is possible to define a specific syslog template per output file instead of |
| 78 | using the default one. |
| 79 | |
| 80 | .. code-block:: yaml |
| 81 | |
| 82 | rsyslog: |
| 83 | output: |
| 84 | file: |
| 85 | /var/log/your-app.log: |
| 86 | template: ""%syslogtag:1:32%%msg:::sp-if-no-1st-sp%%msg%\\n"" |
| 87 | filter: "if $programname startswith 'your-app' then" |
| 88 | |
teoyaomiqui | 5f07430 | 2017-04-11 15:03:55 +0300 | [diff] [blame] | 89 | Remote rsyslog server |
| 90 | ===================== |
| 91 | |
| 92 | It is possible to have rsyslog act as remote server, collecting, storing or forwarding logs. |
| 93 | This functionality is provided via rsyslog input/output modules, rulesets and templates. |
| 94 | |
| 95 | .. code-block:: yaml |
| 96 | |
| 97 | rsyslog: |
| 98 | server: |
| 99 | enabled: true |
| 100 | module: |
| 101 | imudp: {} |
| 102 | template: |
| 103 | RemoteFilePath: |
| 104 | parameter: |
| 105 | type: string |
| 106 | string: /var/log/%HOSTNAME%/%programname%.log |
| 107 | ruleset: |
| 108 | remote10514: |
| 109 | description: action(type="omfile" dynaFile="RemoteFilePath") |
| 110 | input: |
| 111 | imudp: |
| 112 | port: 10514 |
| 113 | ruleset: remote10514 |
| 114 | |
| 115 | |
| 116 | |
Swann Croiset | d88acef | 2017-03-16 09:17:55 +0100 | [diff] [blame] | 117 | Support metadata |
| 118 | ================ |
| 119 | |
| 120 | If the *heka* support metadata is enabled, all output files are automatically |
| 121 | parsed by the **log_collector** service. |
| 122 | To skip the log_collector configuration, set the **skip_log_collector** to true. |
| 123 | |
| 124 | .. code-block:: yaml |
| 125 | |
| 126 | rsyslog: |
| 127 | output: |
| 128 | file: |
| 129 | /var/log/your-app.log: |
| 130 | filter: "if $programname startswith 'your-app' then" |
| 131 | skip_log_collector: true |
jan kaufman | 28d7d89 | 2015-12-04 21:36:59 +0100 | [diff] [blame] | 132 | |
| 133 | Read more |
| 134 | ========= |
| 135 | |
| 136 | http://www.rsyslog.com/ |
| 137 | https://wiki.gentoo.org/wiki/Rsyslog |
| 138 | https://github.com/saz/puppet-rsyslog |
Filip Pytloun | bb569f2 | 2017-02-02 13:02:03 +0100 | [diff] [blame] | 139 | |
| 140 | Documentation and Bugs |
| 141 | ====================== |
| 142 | |
| 143 | To learn how to install and update salt-formulas, consult the documentation |
| 144 | available online at: |
| 145 | |
| 146 | http://salt-formulas.readthedocs.io/ |
| 147 | |
| 148 | In the unfortunate event that bugs are discovered, they should be reported to |
| 149 | the appropriate issue tracker. Use Github issue tracker for specific salt |
| 150 | formula: |
| 151 | |
| 152 | https://github.com/salt-formulas/salt-formula-rsyslog/issues |
| 153 | |
| 154 | For feature requests, bug reports or blueprints affecting entire ecosystem, |
| 155 | use Launchpad salt-formulas project: |
| 156 | |
| 157 | https://launchpad.net/salt-formulas |
| 158 | |
| 159 | You can also join salt-formulas-users team and subscribe to mailing list: |
| 160 | |
| 161 | https://launchpad.net/~salt-formulas-users |
| 162 | |
| 163 | Developers wishing to work on the salt-formulas projects should always base |
| 164 | their work on master branch and submit pull request against specific formula. |
| 165 | |
| 166 | https://github.com/salt-formulas/salt-formula-rsyslog |
| 167 | |
| 168 | Any questions or feedback is always welcome so feel free to join our IRC |
| 169 | channel: |
| 170 | |
| 171 | #salt-formulas @ irc.freenode.net |