-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[rsyslog]: Use RELP instead of UDP for forwarding from container to host #18113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
e348e26
e275fd2
af610f2
1df7538
7c937cc
dd7af0a
6ebca5f
ed01b28
bbe163b
e030511
ab995b0
d57c5ba
4d8056b
bf9cda9
d5edef8
20e8621
5310d94
5444c45
dce24d6
d115668
ed6fc69
b539ebb
7213eda
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,24 +9,20 @@ | |
| #### MODULES #### | ||
| ################# | ||
|
|
||
| $ModLoad imuxsock # provides support for local system logging | ||
|
|
||
| # | ||
| # Set a rate limit on messages from the container | ||
| # | ||
| $SystemLogRateLimitInterval 300 | ||
| $SystemLogRateLimitBurst 20000 | ||
|
|
||
| #$ModLoad imklog # provides kernel logging support | ||
| #$ModLoad immark # provides --MARK-- message capability | ||
| module(load="imuxsock" SysSock.RateLimit.Interval="300" SysSock.RateLimit.Burst="20000") # provides support for local system logging | ||
| #module(load="imklog") # provides kernel logging support | ||
| #module(load="immark") # provides --MARK-- message capability | ||
|
|
||
| # provides UDP syslog reception | ||
| #$ModLoad imudp | ||
| #$UDPServerRun 514 | ||
| #module(load="imudp") | ||
| #input(type="imudp" port="514") | ||
|
|
||
| # provides TCP syslog reception | ||
| #$ModLoad imtcp | ||
| #$InputTCPServerRun 514 | ||
| #module(load="imtcp") | ||
| #input(type="imtcp" port="514") | ||
|
|
||
|
|
||
| ########################### | ||
|
|
@@ -37,7 +33,8 @@ set $.CONTAINER_NAME=getenv("CONTAINER_NAME"); | |
|
|
||
| # Set remote syslog server | ||
| template (name="ForwardFormatInContainer" type="string" string="<%PRI%>%TIMESTAMP:::date-rfc3339% %HOSTNAME% %$.CONTAINER_NAME%#%syslogtag%%msg:::sp-if-no-1st-sp%%msg%") | ||
| *.* action(type="omfwd" target=`echo $SYSLOG_TARGET_IP` port="514" protocol="udp" Template="ForwardFormatInContainer") | ||
| module(load="omrelp") | ||
| *.* action(type="omrelp" target=`echo $SYSLOG_TARGET_IP` port="2514" action.resumeRetryCount="60" queue.type="LinkedList" queue.size="20000" Template="ForwardFormatInContainer") | ||
|
||
|
|
||
| # | ||
| # Use traditional timestamp format. | ||
|
|
@@ -75,4 +72,4 @@ $RepeatedMsgReduction on | |
|
|
||
| ############### | ||
| #### RULES #### | ||
| ############### | ||
| ############### | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -13,40 +13,34 @@ | |||||||||||||||||
| #### MODULES #### | ||||||||||||||||||
| ################# | ||||||||||||||||||
|
|
||||||||||||||||||
| $ModLoad imuxsock # provides support for local system logging | ||||||||||||||||||
| {% if syslog_counter and syslog_counter == "true" %} | ||||||||||||||||||
| $ModLoad omprog | ||||||||||||||||||
| {% endif %} | ||||||||||||||||||
|
|
||||||||||||||||||
| {% set gconf = (SYSLOG_CONFIG | d({})).get('GLOBAL', {}) -%} | ||||||||||||||||||
| {% set rate_limit_interval = gconf.get('rate_limit_interval') %} | ||||||||||||||||||
| {% set rate_limit_burst = gconf.get('rate_limit_burst') %} | ||||||||||||||||||
| {% set rate_limit_interval = gconf.get('rate_limit_interval') -%} | ||||||||||||||||||
| {% set rate_limit_burst = gconf.get('rate_limit_burst') -%} | ||||||||||||||||||
|
|
||||||||||||||||||
| {% if rate_limit_interval is not none %} | ||||||||||||||||||
| $SystemLogRateLimitInterval {{ rate_limit_interval }} | ||||||||||||||||||
| {% endif %} | ||||||||||||||||||
| {% if rate_limit_burst is not none %} | ||||||||||||||||||
| $SystemLogRateLimitBurst {{ rate_limit_burst }} | ||||||||||||||||||
| module(load="imuxsock" {% if rate_limit_interval is not none %}SysSock.RateLimit.Interval="{{ rate_limit_interval }}"{% endif %} {% if rate_limit_burst is not none %}SysSock.RateLimit.Burst="{{ rate_limit_burst }}"{% endif %}) # provides support for local system logging | ||||||||||||||||||
| module(load="imklog" ParseKernelTimestamp="off" KeepKernelTimestamp="on") # provides kernel logging support | ||||||||||||||||||
| #module(load="immark") # provides --MARK-- message capability | ||||||||||||||||||
| {% if syslog_counter and syslog_counter == "true" %} | ||||||||||||||||||
| module(load="omprog") | ||||||||||||||||||
| {% endif %} | ||||||||||||||||||
|
|
||||||||||||||||||
| $ModLoad imklog # provides kernel logging support | ||||||||||||||||||
| $KlogParseKernelTimestamp off | ||||||||||||||||||
| $KlogKeepKernelTimestamp on | ||||||||||||||||||
|
|
||||||||||||||||||
| #$ModLoad immark # provides --MARK-- message capability | ||||||||||||||||||
|
|
||||||||||||||||||
| # provides UDP syslog reception | ||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @saiarcot895 This UDP syslog is for remote server?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, in the case of a remote syslog server sending over UDP. |
||||||||||||||||||
| $ModLoad imudp | ||||||||||||||||||
| $UDPServerAddress {{udp_server_ip}} #bind to localhost before udp server run | ||||||||||||||||||
| $UDPServerRun 514 | ||||||||||||||||||
| module(load="imudp") | ||||||||||||||||||
| input(type="imudp" address="{{udp_server_ip}}" port="514") | ||||||||||||||||||
| {% if docker0_ip and docker0_ip != "" %} | ||||||||||||||||||
| $UDPServerAddress {{docker0_ip}} | ||||||||||||||||||
| $UDPServerRun 514 | ||||||||||||||||||
| input(type="imudp" address="{{docker0_ip}}" port="514") | ||||||||||||||||||
| {% endif%} | ||||||||||||||||||
|
Comment on lines
27
to
32
|
||||||||||||||||||
|
|
||||||||||||||||||
| # provides TCP syslog reception | ||||||||||||||||||
| #$ModLoad imtcp | ||||||||||||||||||
| #$InputTCPServerRun 514 | ||||||||||||||||||
| #module(load="imtcp") | ||||||||||||||||||
| #input(type="imtcp" port="514") | ||||||||||||||||||
|
|
||||||||||||||||||
| # provides RELP syslog reception | ||||||||||||||||||
| module(load="imrelp") | ||||||||||||||||||
| input(type="imrelp" address="{{udp_server_ip}}" port="2514") | ||||||||||||||||||
| {% if docker0_ip and docker0_ip != "" %} | ||||||||||||||||||
| input(type="imrelp" address="{{docker0_ip}}" port="2514") | ||||||||||||||||||
| {% endif%} | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
| ########################### | ||||||||||||||||||
|
|
@@ -61,7 +55,7 @@ $UDPServerRun 514 | |||||||||||||||||
| #$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat | ||||||||||||||||||
|
|
||||||||||||||||||
| # Define a custom template | ||||||||||||||||||
| $template SONiCFileFormat,"%timegenerated:::date-year% %timegenerated%.%timegenerated:::date-subseconds% {{ hostname }} %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n" | ||||||||||||||||||
| $template SONiCFileFormat,"%TIMESTAMP:::date-year% %TIMESTAMP%.%TIMESTAMP:::date-subseconds% {{ hostname }} %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n" | ||||||||||||||||||
| $ActionFileDefaultTemplate SONiCFileFormat | ||||||||||||||||||
| $template SONiCForwardFormat,"<%PRI%>%TIMESTAMP:::date-rfc3339% {{ hostname }} %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n" | ||||||||||||||||||
| $template SONiCForwardFormatWithOsVersion,"<%PRI%>%TIMESTAMP:::date-rfc3339% {{ hostname }} {{os_version}} %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n" | ||||||||||||||||||
|
Comment on lines
+58
to
61
|
||||||||||||||||||
| $template SONiCFileFormat,"%TIMESTAMP:::date-year% %TIMESTAMP%.%TIMESTAMP:::date-subseconds% {{ hostname }} %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n" | |
| $ActionFileDefaultTemplate SONiCFileFormat | |
| $template SONiCForwardFormat,"<%PRI%>%TIMESTAMP:::date-rfc3339% {{ hostname }} %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n" | |
| $template SONiCForwardFormatWithOsVersion,"<%PRI%>%TIMESTAMP:::date-rfc3339% {{ hostname }} {{os_version}} %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n" | |
| $template SONiCFileFormat,"%timegenerated:::date-year% %timegenerated%.%timegenerated:::date-subseconds% {{ hostname }} %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n" | |
| $ActionFileDefaultTemplate SONiCFileFormat | |
| $template SONiCForwardFormat,"<%PRI%>%timegenerated:::date-rfc3339% {{ hostname }} %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n" | |
| $template SONiCForwardFormatWithOsVersion,"<%PRI%>%timegenerated:::date-rfc3339% {{ hostname }} {{os_version}} %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@saiarcot895 can you mention this syntax change in PR description
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.