blob: 701369c065dcee11766ee7b8455c308b8ab0c373 [file] [log] [blame]
Éric Lemoinef62ab312016-12-13 10:50:56 +00001{%- from "rsyslog/map.jinja" import global with context %}
2log_collector:
3 decoder:
4 syslog:
5 engine: sandbox
6 module_file: /usr/share/lma_collector/decoders/generic_syslog.lua
7 module_dir: /usr/share/lma_collector/common;/usr/share/heka/lua_modules
8 adjust_timezone: true
9 config:
10 {%- if global.format is defined %}
11 syslog_pattern: '{{ global.format.template }}'
12 fallback_syslog_pattern: '%TIMESTAMP% %HOSTNAME% %syslogtag%%msg:::sp-if-no-1st-sp%%msg%\n'
13 {%- else %}
14 syslog_pattern: '%TIMESTAMP% %HOSTNAME% %syslogtag%%msg:::sp-if-no-1st-sp%%msg%\n'
15 {%- endif %}
16 input:
Petr Michalec3087c9c2017-03-30 19:07:17 +020017 {%- if salt.get('rsyslog_util.syslog_file_match', None) %}
Éric Lemoine3b9a74a2016-12-13 17:32:00 +000018 {%- set file_match = salt['rsyslog_util.syslog_file_match'](global.output) %}
19 {%- if file_match|length > 0 %}
Éric Lemoine48f39bf2016-12-13 16:31:28 +010020 {%- for logdir, pattern in file_match.iteritems() %}
21 syslog{{ logdir.replace('/', '_') }}:
Éric Lemoinef62ab312016-12-13 10:50:56 +000022 engine: logstreamer
Éric Lemoine48f39bf2016-12-13 16:31:28 +010023 log_directory: "{{ logdir }}"
24 file_match: '(?P<Service>{{ pattern }})'
Éric Lemoinef62ab312016-12-13 10:50:56 +000025 differentiator: [ 'system.', 'Service' ]
26 decoder: "syslog_decoder"
27 splitter: "TokenSplitter"
Éric Lemoine48f39bf2016-12-13 16:31:28 +010028 {%- endfor %}
Éric Lemoine3b9a74a2016-12-13 17:32:00 +000029 {%- endif %}
Petr Michalec3087c9c2017-03-30 19:07:17 +020030 {%- endif %}
Éric Lemoine3b9a74a2016-12-13 17:32:00 +000031 syslog_haproxy:
32 engine: logstreamer
33 log_directory: "/var/log"
34 file_match: 'haproxy\.log'
35 differentiator: [ 'system.', 'haproxy' ]
36 decoder: "syslog_decoder"
37 splitter: "TokenSplitter"
Simon Pasquierdfcfbb12017-02-22 11:04:01 +010038 filter:
39 failed_logins:
40 engine: sandbox
41 module_file: /usr/share/lma_collector/filters/failed_logins.lua
42 module_dir: /usr/share/lma_collector/common;/usr/share/heka/lua_modules
43 message_matcher: "Type == 'log' && Logger == 'system.auth'"
44 ticker_interval: 60
45 config:
46 hostname: '{{ grains.host }}'
47 grace_interval: 30
Simon Pasquiere37150b2017-02-23 10:44:42 +010048metric_collector:
49 trigger:
50 failed_logins_warning:
51 description: 'The rate of failed logins is too high.'
52 severity: warning
53 rules:
54 - metric: failed_logins_rate
55 relational_operator: '>='
56 threshold: 0.2
57 window: 120
58 periods: 0
59 function: avg
60 alarm:
61 failed_logins:
62 alerting: enabled
63 triggers:
64 - failed_logins_warning