Skip to content

Commit c92f780

Browse files
Merge pull request #452 from CodeNow/enforce-omfile-permissions
enforce permissions and clear formatting
2 parents 0b0ab9b + edb567e commit c92f780

4 files changed

Lines changed: 79 additions & 2 deletions

File tree

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Default rules for rsyslog.
2+
#
3+
# For more information see rsyslog.conf(5) and /etc/rsyslog.conf
4+
5+
#
6+
# First some standard log files. Log by facility.
7+
#
8+
auth,authpriv.* /var/log/auth.log
9+
*.*;auth,authpriv.none -/var/log/syslog
10+
#cron.* /var/log/cron.log
11+
#daemon.* -/var/log/daemon.log
12+
kern.* -/var/log/kern.log
13+
#lpr.* -/var/log/lpr.log
14+
mail.* -/var/log/mail.log
15+
#user.* -/var/log/user.log
16+
17+
#
18+
# Logging for the mail system. Split it up so that
19+
# it is easy to write scripts to parse these files.
20+
#
21+
#mail.info -/var/log/mail.info
22+
#mail.warn -/var/log/mail.warn
23+
mail.err /var/log/mail.err
24+
25+
#
26+
# Logging for INN news system.
27+
#
28+
news.crit /var/log/news/news.crit
29+
news.err /var/log/news/news.err
30+
news.notice -/var/log/news/news.notice
31+
32+
#
33+
# Some "catch-all" log files.
34+
#
35+
#*.=debug;\
36+
# auth,authpriv.none;\
37+
# news.none;mail.none -/var/log/debug
38+
#*.=info;*.=notice;*.=warn;\
39+
# auth,authpriv.none;\
40+
# cron,daemon.none;\
41+
# mail,news.none -/var/log/messages
42+
43+
#
44+
# Emergencies are sent to everybody logged in.
45+
#
46+
*.emerg :omusrmsg:*
47+
48+
#
49+
# I like to have messages displayed on the console, but only on a virtual
50+
# console I usually leave idle.
51+
#
52+
#daemon,mail.*;\
53+
# news.=crit;news.=err;news.=notice;\
54+
# *.=debug;*.=info;\
55+
# *.=notice;*.=warn /dev/tty8
56+
57+
# The named pipe /dev/xconsole is for the `xconsole' utility. To use it,
58+
# you must invoke `xconsole' with the `-file' option:
59+
#
60+
# $ xconsole -file /dev/xconsole [...]
61+
#
62+
# NOTE: adjust the list below, or you'll go crazy if you have a reasonably
63+
# busy site..
64+
#
65+
daemon.*;mail.*;\
66+
news.err;\
67+
*.=debug;*.=info;\
68+
*.=notice;*.=warn |/dev/xconsole

ansible/roles/loggly/files/rsyslog.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ $ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
3838
# Runnable JSON logging format
3939
# Creates an "output formatter" template that accepts as input JSON and prints it out without any further processing ("raw JSON").
4040
# The formatting around the %msg% string is as such: start printing at the second character "2" until the end of the line "$" using the raw JSON format type.
41-
$template RunnableJSON,"%msg:2:$:jsonr%\n"
41+
$template RunnableJSON,"%msg:2:$:%\n"
4242

4343
# Filter duplicated messages
4444
$RepeatedMsgReduction on

ansible/roles/loggly/tasks/main.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@
99
cache_valid_time=604800
1010
install_recommends=yes
1111

12+
- name: copy rsyslog default config
13+
tags: loggly
14+
become: true
15+
copy:
16+
src=50-default.conf
17+
dest=/etc/rsyslog.d/50-default.conf
18+
owner=syslog
19+
group=syslog
20+
1221
- name: copy loggly TLS config
1322
tags: loggly
1423
become: true

ansible/roles/loggly/templates/21-output-syslog.conf.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ $WorkDirectory /var/spool/rsyslog
22

33
# Rotate per hour
44
$template RotateHourly_{{ name }},"{{ app_log_dir }}/%$YEAR%/%$MONTH%/%$DAY%/%$HOUR%/{{ name }}.log"
5-
if $msg contains '{{ name }}' and $syslogfacility-text == 'local7' then { action (type="omfile" DynaFile="RotateHourly_{{ name }}" template="RunnableJSON") }
5+
if $msg contains '{{ name }}' and $syslogfacility-text == 'local7' then { action (type="omfile" DynaFile="RotateHourly_{{ name }}" template="RunnableJSON" dirCreateMode="0755" FileCreateMode="0644") }
66

77
# Loggly: Add a tag for {{ name }} events
88
$template LogglyFormat_{{ name }},"<%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [{{ loggly_token }}@41058 tag=\"runnable\" tag=\"{{ node_env }}\"] %msg%\n"

0 commit comments

Comments
 (0)