1
+ #
2
+ # /etc/rsyslog.conf Configuration file for rsyslog.
3
+ #
4
+ # For more information see
5
+ # /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html
6
+
7
+
8
+ #################
9
+ #### MODULES ####
10
+ #################
11
+
12
+ $ModLoad imuxsock # provides support for local system logging
13
+
14
+ #
15
+ # Set a rate limit on messages from the container
16
+ #
17
+ $SystemLogRateLimitInterval 300
18
+ $SystemLogRateLimitBurst 20000
19
+
20
+ #$ModLoad imklog # provides kernel logging support
21
+ #$ModLoad immark # provides --MARK-- message capability
22
+
23
+ # provides UDP syslog reception
24
+ #$ModLoad imudp
25
+ #$UDPServerRun 514
26
+
27
+ # provides TCP syslog reception
28
+ #$ModLoad imtcp
29
+ #$InputTCPServerRun 514
30
+
31
+
32
+ ###########################
33
+ #### GLOBAL DIRECTIVES ####
34
+ ###########################
35
+
36
+ set $.CONTAINER_NAME=getenv("CONTAINER_NAME");
37
+
38
+ # Set remote syslog server
39
+ template (name="ForwardFormatInContainer" type="string" string="<%PRI%>%TIMESTAMP:::date-rfc3339% %HOSTNAME% %$.CONTAINER_NAME%#%syslogtag%%msg:::sp-if-no-1st-sp%%msg%")
40
+ *.* action(type="omfwd" target=`echo $SYSLOG_TARGET_IP` port="514" protocol="udp" Template="ForwardFormatInContainer")
41
+
42
+ #
43
+ # Use traditional timestamp format.
44
+ # To enable high precision timestamps, comment out the following line.
45
+ #
46
+ #$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
47
+
48
+ # Define a custom template
49
+ $template SONiCFileFormat,"%TIMESTAMP%.%timestamp:::date-subseconds% %HOSTNAME% %syslogseverity-text:::uppercase% %$.CONTAINER_NAME%#%syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n"
50
+ $ActionFileDefaultTemplate SONiCFileFormat
51
+
52
+ #
53
+ # Set the default permissions for all log files.
54
+ #
55
+ $FileOwner root
56
+ $FileGroup adm
57
+ $FileCreateMode 0640
58
+ $DirCreateMode 0755
59
+ $Umask 0022
60
+
61
+ #
62
+ # Where to place spool and state files
63
+ #
64
+ $WorkDirectory /var/spool/rsyslog
65
+
66
+ #
67
+ # Include all config files in /etc/rsyslog.d/
68
+ #
69
+ $IncludeConfig /etc/rsyslog.d/*.conf
70
+
71
+ #
72
+ # Suppress duplicate messages and report "message repeated n times"
73
+ #
74
+ $RepeatedMsgReduction on
75
+
76
+ ###############
77
+ #### RULES ####
78
+ ###############
0 commit comments