Last active
April 20, 2016 14:24
-
-
Save dpwrussell/7e0ee2498714c9ea4d6fba4c26792855 to your computer and use it in GitHub Desktop.
omero syslog ansible
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<included> | |
<!-- syslog ///////////////////////////////////////////////////////////////// --> | |
<appender name="SYSLOG" class="ch.qos.logback.classic.net.SyslogAppender"> | |
<syslogHost>localhost</syslogHost> | |
<facility>local6</facility> | |
<suffixPattern>OMERO [%thread] %logger %msg</suffixPattern> | |
</appender> | |
</included> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# Configure rsyslog to listen on localhost and OMERO to log to syslog (using local6 facility) | |
- name: Load UDP module | |
lineinfile: | |
dest: /etc/rsyslog.conf | |
regexp: '^#?\$ModLoad imudp$' | |
line: "$ModLoad imudp" | |
state: present | |
notify: restart rsyslog | |
- name: Run UDP Server on port 514 | |
lineinfile: | |
dest: /etc/rsyslog.conf | |
regexp: '^#?\$UDPServerRun 514$' | |
line: "$UDPServerRun 514" | |
state: present | |
notify: restart rsyslog | |
- name: Run UDP Server on localhost interface | |
lineinfile: | |
dest: /etc/rsyslog.conf | |
insertafter: '^\$ModLoad imudp$' | |
line: "$UDPServerAddress localhost" | |
state: present | |
notify: restart rsyslog | |
- name: Stop /var/log/messages from logging everything from OMERO (using local6 facility) | |
lineinfile: | |
dest: /etc/rsyslog.conf | |
regexp: '^\*\.info;mail\.none;authpriv\.none;cron\.none(;local6\.none)?\s*/var/log/messages$' | |
line: "*.info;mail.none;authpriv.none;cron.none;local6.none /var/log/messages" | |
state: present | |
- name: Install syslog logback configuration | |
template: | |
src: omero_server_etc/logback_syslog.xml | |
dest: "{{ omero_base }}/OMERO.server/current/etc/logback_syslog.xml" | |
owner: "{{ omero_user }}" | |
group: "{{ omero_group }}" | |
mode: 0755 | |
- name: Include syslog logback configuration in main logback configuration | |
lineinfile: | |
dest: "{{ omero_base }}/OMERO.server/current/etc/logback.xml" | |
insertafter: '^<configuration scan="true" debug="false">$' | |
line: ' <include file="{{ omero_base }}/OMERO.server/current/etc/logback_syslog.xml"/>' | |
state: present | |
- name: Set the logback root logger to append to syslog | |
lineinfile: | |
dest: "{{ omero_base }}/OMERO.server/current/etc/logback.xml" | |
insertafter: '^\s*<root level="OFF">$' | |
line: ' <appender-ref ref="SYSLOG"/>' | |
state: present |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: restart rsyslog | |
service: name=rsyslog state=restarted |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment