Map logging timeout value to healthchecktimeout for http in rsyslog config

This commit is contained in:
Christian Adams
2020-04-13 12:19:10 -04:00
parent e52cebc28e
commit a0e31b9c01
4 changed files with 10 additions and 12 deletions

View File

@@ -44,7 +44,7 @@ data_loggly = {
'https', 'https',
'\n'.join([ '\n'.join([
'template(name="awx" type="string" string="%rawmsg-after-pri%")\nmodule(load="omhttp")', 'template(name="awx" type="string" string="%rawmsg-after-pri%")\nmodule(load="omhttp")',
'action(type="omhttp" server="logs-01.loggly.com" serverport="80" usehttps="off" skipverifyhost="off" action.resumeRetryCount="-1" template="awx" errorfile="/var/log/tower/external.err" healthchecktimeout="20000" restpath="inputs/1fd38090-2af1-4e1e-8d80-492899da0f71/tag/http/")', # noqa 'action(type="omhttp" server="logs-01.loggly.com" serverport="80" usehttps="off" skipverifyhost="off" action.resumeRetryCount="-1" template="awx" errorfile="/var/log/tower/rsyslog.err" healthchecktimeout="5000" restpath="inputs/1fd38090-2af1-4e1e-8d80-492899da0f71/tag/http/")', # noqa
]) ])
), ),
( (
@@ -77,7 +77,7 @@ data_loggly = {
None, None,
'\n'.join([ '\n'.join([
'template(name="awx" type="string" string="%rawmsg-after-pri%")\nmodule(load="omhttp")', 'template(name="awx" type="string" string="%rawmsg-after-pri%")\nmodule(load="omhttp")',
'action(type="omhttp" server="yoursplunk" serverport="443" usehttps="on" skipverifyhost="off" action.resumeRetryCount="-1" template="awx" errorfile="/var/log/tower/external.err" healthchecktimeout="20000" restpath="services/collector/event")', # noqa 'action(type="omhttp" server="yoursplunk" serverport="443" usehttps="on" skipverifyhost="off" action.resumeRetryCount="-1" template="awx" errorfile="/var/log/tower/rsyslog.err" healthchecktimeout="5000" restpath="services/collector/event")', # noqa
]) ])
), ),
( (
@@ -88,7 +88,7 @@ data_loggly = {
None, None,
'\n'.join([ '\n'.join([
'template(name="awx" type="string" string="%rawmsg-after-pri%")\nmodule(load="omhttp")', 'template(name="awx" type="string" string="%rawmsg-after-pri%")\nmodule(load="omhttp")',
'action(type="omhttp" server="yoursplunk" serverport="80" usehttps="off" skipverifyhost="off" action.resumeRetryCount="-1" template="awx" errorfile="/var/log/tower/external.err" healthchecktimeout="20000" restpath="services/collector/event")', # noqa 'action(type="omhttp" server="yoursplunk" serverport="80" usehttps="off" skipverifyhost="off" action.resumeRetryCount="-1" template="awx" errorfile="/var/log/tower/rsyslog.err" healthchecktimeout="5000" restpath="services/collector/event")', # noqa
]) ])
), ),
( (
@@ -99,7 +99,7 @@ data_loggly = {
None, None,
'\n'.join([ '\n'.join([
'template(name="awx" type="string" string="%rawmsg-after-pri%")\nmodule(load="omhttp")', 'template(name="awx" type="string" string="%rawmsg-after-pri%")\nmodule(load="omhttp")',
'action(type="omhttp" server="yoursplunk" serverport="8088" usehttps="on" skipverifyhost="off" action.resumeRetryCount="-1" template="awx" errorfile="/var/log/tower/external.err" healthchecktimeout="20000" restpath="services/collector/event")', # noqa 'action(type="omhttp" server="yoursplunk" serverport="8088" usehttps="on" skipverifyhost="off" action.resumeRetryCount="-1" template="awx" errorfile="/var/log/tower/rsyslog.err" healthchecktimeout="5000" restpath="services/collector/event")', # noqa
]) ])
), ),
( (
@@ -110,7 +110,7 @@ data_loggly = {
None, None,
'\n'.join([ '\n'.join([
'template(name="awx" type="string" string="%rawmsg-after-pri%")\nmodule(load="omhttp")', 'template(name="awx" type="string" string="%rawmsg-after-pri%")\nmodule(load="omhttp")',
'action(type="omhttp" server="yoursplunk" serverport="8088" usehttps="on" skipverifyhost="off" action.resumeRetryCount="-1" template="awx" errorfile="/var/log/tower/external.err" healthchecktimeout="20000" restpath="services/collector/event")', # noqa 'action(type="omhttp" server="yoursplunk" serverport="8088" usehttps="on" skipverifyhost="off" action.resumeRetryCount="-1" template="awx" errorfile="/var/log/tower/rsyslog.err" healthchecktimeout="5000" restpath="services/collector/event")', # noqa
]) ])
), ),
( (
@@ -121,7 +121,7 @@ data_loggly = {
'https', 'https',
'\n'.join([ '\n'.join([
'template(name="awx" type="string" string="%rawmsg-after-pri%")\nmodule(load="omhttp")', 'template(name="awx" type="string" string="%rawmsg-after-pri%")\nmodule(load="omhttp")',
'action(type="omhttp" server="yoursplunk.org" serverport="8088" usehttps="on" skipverifyhost="off" action.resumeRetryCount="-1" template="awx" errorfile="/var/log/tower/external.err" healthchecktimeout="20000" restpath="services/collector/event")', # noqa 'action(type="omhttp" server="yoursplunk.org" serverport="8088" usehttps="on" skipverifyhost="off" action.resumeRetryCount="-1" template="awx" errorfile="/var/log/tower/rsyslog.err" healthchecktimeout="5000" restpath="services/collector/event")', # noqa
]) ])
), ),
( (
@@ -132,7 +132,7 @@ data_loggly = {
None, None,
'\n'.join([ '\n'.join([
'template(name="awx" type="string" string="%rawmsg-after-pri%")\nmodule(load="omhttp")', 'template(name="awx" type="string" string="%rawmsg-after-pri%")\nmodule(load="omhttp")',
'action(type="omhttp" server="yoursplunk.org" serverport="8088" usehttps="off" skipverifyhost="off" action.resumeRetryCount="-1" template="awx" errorfile="/var/log/tower/external.err" healthchecktimeout="20000" restpath="services/collector/event")', # noqa 'action(type="omhttp" server="yoursplunk.org" serverport="8088" usehttps="off" skipverifyhost="off" action.resumeRetryCount="-1" template="awx" errorfile="/var/log/tower/rsyslog.err" healthchecktimeout="5000" restpath="services/collector/event")', # noqa
]) ])
), ),
] ]

View File

@@ -11,6 +11,7 @@ def construct_rsyslog_conf_template(settings=settings):
host = getattr(settings, 'LOG_AGGREGATOR_HOST', '') host = getattr(settings, 'LOG_AGGREGATOR_HOST', '')
port = getattr(settings, 'LOG_AGGREGATOR_PORT', '') port = getattr(settings, 'LOG_AGGREGATOR_PORT', '')
protocol = getattr(settings, 'LOG_AGGREGATOR_PROTOCOL', '') protocol = getattr(settings, 'LOG_AGGREGATOR_PROTOCOL', '')
timeout = str(getattr(settings, 'LOG_AGGREGATOR_TCP_TIMEOUT', 5) * 1000)
if protocol.startswith('http'): if protocol.startswith('http'):
scheme = 'https' scheme = 'https'
# urlparse requires '//' to be provided if scheme is not specified # urlparse requires '//' to be provided if scheme is not specified
@@ -49,8 +50,8 @@ def construct_rsyslog_conf_template(settings=settings):
f'skipverifyhost="{skip_verify}"', f'skipverifyhost="{skip_verify}"',
'action.resumeRetryCount="-1"', 'action.resumeRetryCount="-1"',
'template="awx"', 'template="awx"',
'errorfile="/var/log/tower/external.err"', 'errorfile="/var/log/tower/rsyslog.err"',
'healthchecktimeout="20000"', f'healthchecktimeout="{timeout}"',
] ]
if parsed.path: if parsed.path:
path = urlparse.quote(parsed.path[1:]) path = urlparse.quote(parsed.path[1:])

View File

@@ -214,7 +214,6 @@
- 'deployment' - 'deployment'
- 'supervisor' - 'supervisor'
- 'launch_awx' - 'launch_awx'
- 'rsyslog'
no_log: true no_log: true
- name: Apply Deployment - name: Apply Deployment
@@ -226,7 +225,6 @@
- "{{ deployment }}" - "{{ deployment }}"
- "{{ supervisor }}" - "{{ supervisor }}"
- "{{ launch_awx }}" - "{{ launch_awx }}"
- "{{ rsyslog }}"
no_log: true no_log: true
- name: Delete any existing management pod - name: Delete any existing management pod

View File

@@ -9,7 +9,6 @@ services:
hostname: awx hostname: awx
command: launch_awx.sh command: launch_awx.sh
environment: environment:
PYTHONUNBUFFERED: 1
CURRENT_UID: CURRENT_UID:
OS: OS:
SDB_HOST: 0.0.0.0 SDB_HOST: 0.0.0.0