Compare commits
1 commit
stable
...
log2mail-b
Author | SHA1 | Date | |
---|---|---|---|
Jérémy Lecour | 264941e5a0 |
|
@ -1,5 +1,9 @@
|
|||
---
|
||||
elastic_stack_version: "6.x"
|
||||
general_alert_email: "root@localhost"
|
||||
log2mail_alert_email: Null
|
||||
filebeat_log2mail_alert_email: Null
|
||||
|
||||
elastic_stack_version: "7.x"
|
||||
|
||||
filebeat_logstash_plugin: False
|
||||
|
||||
|
|
|
@ -4,3 +4,8 @@
|
|||
systemd:
|
||||
name: filebeat
|
||||
state: restarted
|
||||
|
||||
- name: restart log2mail
|
||||
systemd:
|
||||
name: log2mail
|
||||
state: restarted
|
||||
|
|
21
filebeat/tasks/log2mail.yml
Normal file
21
filebeat/tasks/log2mail.yml
Normal file
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
|
||||
- name: Check if log2mail is installed
|
||||
stat:
|
||||
path: /etc/log2mail/config
|
||||
register: _log2mail_config_dir
|
||||
|
||||
- name: "Add user 'log2mail' to 'filebeat' group"
|
||||
user:
|
||||
name: 'log2mail'
|
||||
groups: 'filebeat'
|
||||
append: yes
|
||||
notify: restart log2mail
|
||||
when: _log2mail_config_dir.stat.isdir
|
||||
|
||||
- name: Install filebeat log2mail configuration
|
||||
template:
|
||||
src: log2mail.j2
|
||||
dest: /etc/log2mail/config/filebeat
|
||||
notify: restart log2mail
|
||||
when: _log2mail_config_dir.stat.isdir
|
|
@ -81,3 +81,5 @@
|
|||
insert_after: '^processors:'
|
||||
notify: restart filebeat
|
||||
when: filebeat_processors_cloud_metadata
|
||||
|
||||
- include: log2mail.yml
|
||||
|
|
4
filebeat/templates/log2mail.j2
Normal file
4
filebeat/templates/log2mail.j2
Normal file
|
@ -0,0 +1,4 @@
|
|||
file = /var/log/filebeat/filebeat
|
||||
pattern = "\bERROR\b"
|
||||
mailto = {{ filebeat_log2mail_alert_email or log2mail_alert_email or general_alert_email | mandatory }}
|
||||
template = /etc/log2mail/mail
|
|
@ -1,5 +1,9 @@
|
|||
---
|
||||
elastic_stack_version: "6.x"
|
||||
general_alert_email: "root@localhost"
|
||||
log2mail_alert_email: Null
|
||||
metricbeat_log2mail_alert_email: Null
|
||||
|
||||
elastic_stack_version: "7.x"
|
||||
|
||||
metricbeat_elasticsearch_protocol: ""
|
||||
metricbeat_elasticsearch_hosts:
|
||||
|
|
|
@ -4,3 +4,8 @@
|
|||
systemd:
|
||||
name: metricbeat
|
||||
state: restarted
|
||||
|
||||
- name: restart log2mail
|
||||
systemd:
|
||||
name: log2mail
|
||||
state: restarted
|
||||
|
|
21
metricbeat/tasks/log2mail.yml
Normal file
21
metricbeat/tasks/log2mail.yml
Normal file
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
|
||||
- name: Check if log2mail is installed
|
||||
stat:
|
||||
path: /etc/log2mail/config
|
||||
register: _log2mail_config_dir
|
||||
|
||||
- name: "Add user 'log2mail' to 'metricbeat' group"
|
||||
user:
|
||||
name: 'log2mail'
|
||||
groups: 'metricbeat'
|
||||
append: yes
|
||||
notify: restart log2mail
|
||||
when: _log2mail_config_dir.stat.isdir
|
||||
|
||||
- name: Install metricbeat log2mail configuration
|
||||
template:
|
||||
src: log2mail.j2
|
||||
dest: /etc/log2mail/config/metricbeat
|
||||
notify: restart log2mail
|
||||
when: _log2mail_config_dir.stat.isdir
|
|
@ -88,3 +88,5 @@
|
|||
insert_after: '^processors:'
|
||||
notify: restart metricbeat
|
||||
when: metricbeat_processors_cloud_metadata
|
||||
|
||||
- include: log2mail.yml
|
||||
|
|
4
metricbeat/templates/log2mail.j2
Normal file
4
metricbeat/templates/log2mail.j2
Normal file
|
@ -0,0 +1,4 @@
|
|||
file = /var/log/metricbeat/metricbeat
|
||||
pattern = "\bERROR\b"
|
||||
mailto = {{ metricbeat_log2mail_alert_email or log2mail_alert_email or general_alert_email | mandatory }}
|
||||
template = /etc/log2mail/mail
|
Loading…
Reference in a new issue