Authored by chunhua.zhang

Merge branch 'media_rsyslog' into 'master'

同步media containers rsyslog配置文件

## inventories/media/hosts
>> 新增media-containers 组

## playbooks/media-rsyslog.yml 
>> 刷新media-containers rsyslog配置文件

## roles/java-rsyslog/templates/rsyslog.module.conf.j2
>> 因为docker containers下的日志路径是/var/lib/docker/applog/,需要判断rsyslog_module是否属于container

See merge request !29
... ... @@ -6,3 +6,10 @@
[nameserver-master]
10.66.251.10
[media-containers]
10.66.251.13
10.66.251.18
10.66.251.21
10.66.251.24
10.66.251.42
... ...
# rsyslog config for media containers
# How to run:
# ansible-playbook -i inventories/media/hosts playbooks/media-rsyslog.yml
- hosts: media-containers
vars:
rsyslog_module: yohomars-platform
rsyslog_files:
- warn-log
- request-timeout
- request-stat
- database-timeout
- database-stat
remote_user: root
roles:
- java-rsyslog
- hosts: media-containers
vars:
rsyslog_module: yohonow-platform
rsyslog_files:
- warn-log
- request-timeout
- request-stat
- database-timeout
- database-stat
remote_user: root
roles:
- java-rsyslog
- hosts: media-containers
vars:
rsyslog_module: yohomars-search
rsyslog_files:
- database-timeout
- index-rebuild
- request-timeout
- request-stat
- slow-sql
- warn-log
remote_user: root
roles:
- java-rsyslog
- hosts: media-containers
vars:
rsyslog_module: yohonow
rsyslog_files:
- request-timeout
- request-stat
- database-timeout
- database-stat
- mq-producer
- mq-consumer
remote_user: root
roles:
- java-rsyslog
- hosts: media-containers
vars:
rsyslog_module: yohomars
rsyslog_files:
- debug-log
- warn-log
- request-timeout
- request-stat
- database-timeout
- database-stat
- mq-producer
- mq-consumer
- points-raffle-msg
remote_user: root
roles:
- java-rsyslog
... ...
... ... @@ -14,6 +14,14 @@
notify:
- reload rsyslog
- name: define docker modules
set_fact:
docker_modules:
- yohonow-platform
- yohomars-platform
- yohomars-search
- yohonow
- yohomars
- name: sync module rsyslog config files
template:
... ...
{% for rsyslog_file in rsyslog_files %}
{% if rsyslog_module in docker_modules %}
$InputFileName /var/lib/docker/applog/{{rsyslog_module}}/{{ rsyslog_file }}.log
{% else %}
$InputFileName /Data/logs/{{rsyslog_module}}/{{ rsyslog_file }}.log
{% endif %}
$InputFileTag {{ rsyslog_module }},{{ rsyslog_file }}
$InputFileSeverity info
$InputFileStateFile state_{{ rsyslog_module }}_{{ rsyslog_file }}
... ...