From efd8feaece45403a872bd471dccec38bd8675c84 Mon Sep 17 00:00:00 2001 From: forrestj Date: Thu, 7 Apr 2016 15:24:58 -0700 Subject: [PATCH 1/2] adding env and service tags to loggly --- ansible/roles/loggly-rotate/templates/21-output-syslog.conf.j2 | 2 +- ansible/roles/loggly-rotate/templates/22-loggly.conf.j2 | 2 +- ansible/roles/loggly/templates/21-filemonitoring-app.conf.j2 | 2 +- ansible/roles/loggly/templates/22-loggly.conf.j2 | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ansible/roles/loggly-rotate/templates/21-output-syslog.conf.j2 b/ansible/roles/loggly-rotate/templates/21-output-syslog.conf.j2 index da5f86f8..d9704f7e 100644 --- a/ansible/roles/loggly-rotate/templates/21-output-syslog.conf.j2 +++ b/ansible/roles/loggly-rotate/templates/21-output-syslog.conf.j2 @@ -9,6 +9,6 @@ if $msg contains '{{ name }}' and $syslogfacility-text == 'local7' then :omfile: # {{ name }} access file: #Add a tag for {{ name }} events -$template LogglyFormatFile{{ name }},"<%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [{{ loggly_token }}@41058 tag=\"file\" ] %msg%\n" +$template LogglyFormatFile{{ name }},"<%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [{{ loggly_token }}@41058 tag=\"runnable\" tag=\"{{ env }}\" ] %msg%\n" if $msg contains '{{ name }}' then @@logs-01.loggly.com:6514;LogglyFormatFile{{ name }} if $msg contains '{{ name }}' then ~ diff --git a/ansible/roles/loggly-rotate/templates/22-loggly.conf.j2 b/ansible/roles/loggly-rotate/templates/22-loggly.conf.j2 index 05256a84..620292c3 100644 --- a/ansible/roles/loggly-rotate/templates/22-loggly.conf.j2 +++ b/ansible/roles/loggly-rotate/templates/22-loggly.conf.j2 @@ -3,7 +3,7 @@ # ------------------------------------------------------- # Define the template used for sending logs to Loggly. Do not change this format. -$template LogglyFormat,"<%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [{{ loggly_token }}@41058] %msg%\n" +$template LogglyFormat,"<%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [{{ loggly_token }}@41058 tag=\"{{ env }}\"] %msg%\n" $WorkDirectory /var/spool/rsyslog # where to place spool files $ActionQueueFileName fwdRule1 # unique name prefix for spool files diff --git a/ansible/roles/loggly/templates/21-filemonitoring-app.conf.j2 b/ansible/roles/loggly/templates/21-filemonitoring-app.conf.j2 index 74bd950d..7e3e6b75 100644 --- a/ansible/roles/loggly/templates/21-filemonitoring-app.conf.j2 +++ b/ansible/roles/loggly/templates/21-filemonitoring-app.conf.j2 @@ -11,6 +11,6 @@ $InputFileSeverity info $InputFilePersistStateInterval 20000 $InputRunFileMonitor #Add a tag for {{ name }} events -$template LogglyFormatFile{{ name }},"<%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [{{ loggly_token }}@41058 tag=\"file\" ] %msg%\n" +$template LogglyFormatFile{{ name }},"<%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [{{ loggly_token }}@41058 tag=\"runnable\" tag=\"{{ env }}\" ] %msg%\n" if $programname == '{{ name }}' then @@logs-01.loggly.com:6514;LogglyFormatFile{{ name }} if $programname == '{{ name }}' then ~ diff --git a/ansible/roles/loggly/templates/22-loggly.conf.j2 b/ansible/roles/loggly/templates/22-loggly.conf.j2 index 05256a84..badeb73a 100644 --- a/ansible/roles/loggly/templates/22-loggly.conf.j2 +++ b/ansible/roles/loggly/templates/22-loggly.conf.j2 @@ -3,7 +3,7 @@ # ------------------------------------------------------- # Define the template used for sending logs to Loggly. Do not change this format. -$template LogglyFormat,"<%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [{{ loggly_token }}@41058] %msg%\n" +$template LogglyFormat,"<%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [{{ loggly_token }}@41058 tag=\"{{ env }}\" ] %msg%\n" $WorkDirectory /var/spool/rsyslog # where to place spool files $ActionQueueFileName fwdRule1 # unique name prefix for spool files From 958241cd23ff21f0383701eea9fe39ef31689dcd Mon Sep 17 00:00:00 2001 From: forrestj Date: Thu, 7 Apr 2016 15:24:58 -0700 Subject: [PATCH 2/2] adding env and service tags to loggly --- ansible/roles/loggly-rotate/templates/21-output-syslog.conf.j2 | 2 +- ansible/roles/loggly-rotate/templates/22-loggly.conf.j2 | 2 +- ansible/roles/loggly/templates/21-filemonitoring-app.conf.j2 | 2 +- ansible/roles/loggly/templates/22-loggly.conf.j2 | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ansible/roles/loggly-rotate/templates/21-output-syslog.conf.j2 b/ansible/roles/loggly-rotate/templates/21-output-syslog.conf.j2 index da5f86f8..0ed5e7b0 100644 --- a/ansible/roles/loggly-rotate/templates/21-output-syslog.conf.j2 +++ b/ansible/roles/loggly-rotate/templates/21-output-syslog.conf.j2 @@ -9,6 +9,6 @@ if $msg contains '{{ name }}' and $syslogfacility-text == 'local7' then :omfile: # {{ name }} access file: #Add a tag for {{ name }} events -$template LogglyFormatFile{{ name }},"<%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [{{ loggly_token }}@41058 tag=\"file\" ] %msg%\n" +$template LogglyFormatFile{{ name }},"<%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [{{ loggly_token }}@41058 tag=\"runnable\" tag=\"{{ node_env }}\" ] %msg%\n" if $msg contains '{{ name }}' then @@logs-01.loggly.com:6514;LogglyFormatFile{{ name }} if $msg contains '{{ name }}' then ~ diff --git a/ansible/roles/loggly-rotate/templates/22-loggly.conf.j2 b/ansible/roles/loggly-rotate/templates/22-loggly.conf.j2 index 05256a84..3ee1a95b 100644 --- a/ansible/roles/loggly-rotate/templates/22-loggly.conf.j2 +++ b/ansible/roles/loggly-rotate/templates/22-loggly.conf.j2 @@ -3,7 +3,7 @@ # ------------------------------------------------------- # Define the template used for sending logs to Loggly. Do not change this format. -$template LogglyFormat,"<%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [{{ loggly_token }}@41058] %msg%\n" +$template LogglyFormat,"<%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [{{ loggly_token }}@41058 tag=\"{{ node_env }}\"] %msg%\n" $WorkDirectory /var/spool/rsyslog # where to place spool files $ActionQueueFileName fwdRule1 # unique name prefix for spool files diff --git a/ansible/roles/loggly/templates/21-filemonitoring-app.conf.j2 b/ansible/roles/loggly/templates/21-filemonitoring-app.conf.j2 index 74bd950d..e9614a67 100644 --- a/ansible/roles/loggly/templates/21-filemonitoring-app.conf.j2 +++ b/ansible/roles/loggly/templates/21-filemonitoring-app.conf.j2 @@ -11,6 +11,6 @@ $InputFileSeverity info $InputFilePersistStateInterval 20000 $InputRunFileMonitor #Add a tag for {{ name }} events -$template LogglyFormatFile{{ name }},"<%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [{{ loggly_token }}@41058 tag=\"file\" ] %msg%\n" +$template LogglyFormatFile{{ name }},"<%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [{{ loggly_token }}@41058 tag=\"runnable\" tag=\"{{ node_env }}\" ] %msg%\n" if $programname == '{{ name }}' then @@logs-01.loggly.com:6514;LogglyFormatFile{{ name }} if $programname == '{{ name }}' then ~ diff --git a/ansible/roles/loggly/templates/22-loggly.conf.j2 b/ansible/roles/loggly/templates/22-loggly.conf.j2 index 05256a84..3a35cf88 100644 --- a/ansible/roles/loggly/templates/22-loggly.conf.j2 +++ b/ansible/roles/loggly/templates/22-loggly.conf.j2 @@ -3,7 +3,7 @@ # ------------------------------------------------------- # Define the template used for sending logs to Loggly. Do not change this format. -$template LogglyFormat,"<%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [{{ loggly_token }}@41058] %msg%\n" +$template LogglyFormat,"<%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [{{ loggly_token }}@41058 tag=\"{{ node_env }}\" ] %msg%\n" $WorkDirectory /var/spool/rsyslog # where to place spool files $ActionQueueFileName fwdRule1 # unique name prefix for spool files