mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 17:37:37 -02:30
properly implement TCP timeouts for external log aggregation
see: https://github.com/ansible/awx/issues/6683
This commit is contained in:
@@ -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/rsyslog.err" healthchecktimeout="5000" 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" action.resumeInterval="5" restpath="inputs/1fd38090-2af1-4e1e-8d80-492899da0f71/tag/http/")', # noqa
|
||||||
])
|
])
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
@@ -55,7 +55,7 @@ data_loggly = {
|
|||||||
'udp',
|
'udp',
|
||||||
'\n'.join([
|
'\n'.join([
|
||||||
'template(name="awx" type="string" string="%rawmsg-after-pri%")',
|
'template(name="awx" type="string" string="%rawmsg-after-pri%")',
|
||||||
'action(type="omfwd" target="localhost" port="9000" protocol="udp" action.resumeRetryCount="-1" template="awx")', # noqa
|
'action(type="omfwd" target="localhost" port="9000" protocol="udp" action.resumeRetryCount="-1" action.resumeInterval="5" template="awx")', # noqa
|
||||||
])
|
])
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
@@ -66,7 +66,7 @@ data_loggly = {
|
|||||||
'tcp',
|
'tcp',
|
||||||
'\n'.join([
|
'\n'.join([
|
||||||
'template(name="awx" type="string" string="%rawmsg-after-pri%")',
|
'template(name="awx" type="string" string="%rawmsg-after-pri%")',
|
||||||
'action(type="omfwd" target="localhost" port="9000" protocol="tcp" action.resumeRetryCount="-1" template="awx")', # noqa
|
'action(type="omfwd" target="localhost" port="9000" protocol="tcp" action.resumeRetryCount="-1" action.resumeInterval="5" template="awx")', # 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/rsyslog.err" healthchecktimeout="5000" 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" action.resumeInterval="5" 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/rsyslog.err" healthchecktimeout="5000" 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" action.resumeInterval="5" 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/rsyslog.err" healthchecktimeout="5000" 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" action.resumeInterval="5" 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/rsyslog.err" healthchecktimeout="5000" 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" action.resumeInterval="5" 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/rsyslog.err" healthchecktimeout="5000" 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" action.resumeInterval="5" 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/rsyslog.err" healthchecktimeout="5000" 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" action.resumeInterval="5" restpath="services/collector/event")', # noqa
|
||||||
])
|
])
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -11,7 +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)
|
timeout = getattr(settings, 'LOG_AGGREGATOR_TCP_TIMEOUT', 5)
|
||||||
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
|
||||||
@@ -51,7 +51,7 @@ def construct_rsyslog_conf_template(settings=settings):
|
|||||||
'action.resumeRetryCount="-1"',
|
'action.resumeRetryCount="-1"',
|
||||||
'template="awx"',
|
'template="awx"',
|
||||||
'errorfile="/var/log/tower/rsyslog.err"',
|
'errorfile="/var/log/tower/rsyslog.err"',
|
||||||
f'healthchecktimeout="{timeout}"',
|
f'action.resumeInterval="{timeout}"'
|
||||||
]
|
]
|
||||||
if parsed.path:
|
if parsed.path:
|
||||||
path = urlparse.quote(parsed.path[1:])
|
path = urlparse.quote(parsed.path[1:])
|
||||||
@@ -79,7 +79,7 @@ def construct_rsyslog_conf_template(settings=settings):
|
|||||||
parts.extend(['module(load="omhttp")', f'action({params})'])
|
parts.extend(['module(load="omhttp")', f'action({params})'])
|
||||||
elif protocol and host and port:
|
elif protocol and host and port:
|
||||||
parts.append(
|
parts.append(
|
||||||
f'action(type="omfwd" target="{host}" port="{port}" protocol="{protocol}" action.resumeRetryCount="-1" template="awx")' # noqa
|
f'action(type="omfwd" target="{host}" port="{port}" protocol="{protocol}" action.resumeRetryCount="-1" action.resumeInterval="{timeout}" template="awx")' # noqa
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
parts.append(f'action(type="omfile" file="/dev/null")') # rsyslog needs *at least* one valid action to start
|
parts.append(f'action(type="omfile" file="/dev/null")') # rsyslog needs *at least* one valid action to start
|
||||||
|
|||||||
Reference in New Issue
Block a user