Skip to content

Commit 00493ea

Browse files
Improve syslog rate limit feature for warm/fast reboot
1 parent ada7c6a commit 00493ea

File tree

21 files changed

+454
-77
lines changed

21 files changed

+454
-77
lines changed

dockers/docker-base-bullseye/Dockerfile.j2

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@ RUN apt-get clean -y && \
119119
apt-get autoremove -y && \
120120
rm -rf /var/lib/apt/lists/* /tmp/* ~/.cache
121121

122+
COPY ["etc/rsyslog.conf", "/etc/rsyslog.conf"]
122123
COPY ["etc/rsyslog.d/*", "/etc/rsyslog.d/"]
123124
COPY ["root/.vimrc", "/root/.vimrc"]
124125

125126
RUN ln /usr/bin/vim.tiny /usr/bin/vim
126127

127128
COPY ["etc/supervisor/supervisord.conf", "/etc/supervisor/"]
128-
COPY ["etc/supervisor/containercfgd.conf", "/etc/supervisor/conf.d/"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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+
###############

dockers/docker-base-buster/Dockerfile.j2

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,10 @@ RUN apt-get clean -y && \
118118
apt-get autoremove -y && \
119119
rm -rf /var/lib/apt/lists/* /tmp/* ~/.cache/
120120

121+
COPY ["etc/rsyslog.conf", "/etc/rsyslog.conf"]
121122
COPY ["etc/rsyslog.d/*", "/etc/rsyslog.d/"]
122123
COPY ["root/.vimrc", "/root/.vimrc"]
123124

124125
RUN ln /usr/bin/vim.tiny /usr/bin/vim
125126

126127
COPY ["etc/supervisor/supervisord.conf", "/etc/supervisor/"]
127-
COPY ["etc/supervisor/containercfgd.conf", "/etc/supervisor/conf.d/"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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+
###############

dockers/docker-base-buster/etc/supervisor/containercfgd.conf

-9
This file was deleted.

dockers/docker-base-stretch/Dockerfile.j2

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ RUN apt-get clean -y && \
114114
apt-get autoremove -y && \
115115
rm -rf /var/lib/apt/lists/* /tmp/*
116116

117+
COPY ["etc/rsyslog.conf", "/etc/rsyslog.conf"]
117118
COPY ["etc/rsyslog.d/*", "/etc/rsyslog.d/"]
118119
COPY ["root/.vimrc", "/root/.vimrc"]
119120

120121
RUN ln /usr/bin/vim.tiny /usr/bin/vim
121122

122123
COPY ["etc/supervisor/supervisord.conf", "/etc/supervisor/"]
123-
COPY ["etc/supervisor/containercfgd.conf", "/etc/supervisor/conf.d/"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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+
###############

dockers/docker-base-stretch/etc/supervisor/containercfgd.conf

-9
This file was deleted.

dockers/docker-base/Dockerfile.j2

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ RUN apt-get -y install \
5050
rsyslog \
5151
less
5252

53+
COPY ["etc/rsyslog.conf", "/etc/rsyslog.conf"]
5354
COPY ["etc/rsyslog.d/*", "/etc/rsyslog.d/"]
5455
COPY ["root/.vimrc", "/root/.vimrc"]
5556

@@ -68,7 +69,6 @@ RUN mkdir -p /etc/supervisor/conf.d
6869
RUN mkdir -p /var/log/supervisor
6970
7071
COPY ["etc/supervisor/supervisord.conf", "/etc/supervisor/"]
71-
COPY ["etc/supervisor/containercfgd.conf", "/etc/supervisor/conf.d/"]
7272
7373
RUN apt-get -y purge \
7474
exim4 \

dockers/docker-base/etc/rsyslog.conf

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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

Comments
 (0)