mirror of
https://github.com/ansible/awx.git
synced 2026-01-15 03:40:42 -03:30
rsyslog hardening (fixing a few weird things we noticed)
This commit is contained in:
parent
70391f96ae
commit
ce82b87d9f
@ -26,9 +26,11 @@ def construct_rsyslog_conf_template(settings=settings):
|
||||
port = parsed.port
|
||||
except ValueError:
|
||||
port = settings.LOG_AGGREGATOR_PORT
|
||||
max_bytes = settings.MAX_EVENT_RES_DATA
|
||||
parts.extend([
|
||||
'$WorkDirectory /var/lib/awx/rsyslog',
|
||||
'$IncludeConfig /etc/rsyslog.d/*.conf',
|
||||
f'$MaxMessageSize {max_bytes}b',
|
||||
'$ModLoad imuxsock',
|
||||
'input(type="imuxsock" Socket="' + settings.LOGGING['handlers']['external_logger']['address'] + '" unlink="on")',
|
||||
'template(name="awx" type="string" string="%msg%")',
|
||||
|
||||
@ -97,7 +97,7 @@ class LogstashFormatterBase(logging.Formatter):
|
||||
|
||||
@classmethod
|
||||
def serialize(cls, message):
|
||||
return bytes(json.dumps(message, cls=DjangoJSONEncoder), 'utf-8')
|
||||
return ' ' + json.dumps(message, cls=DjangoJSONEncoder) + '\000'
|
||||
|
||||
|
||||
class LogstashFormatter(LogstashFormatterBase):
|
||||
|
||||
@ -11,6 +11,8 @@ from django.conf import settings
|
||||
|
||||
class RSysLogHandler(logging.handlers.SysLogHandler):
|
||||
|
||||
append_nul = False
|
||||
|
||||
def emit(self, msg):
|
||||
if not os.path.exists(settings.LOGGING['handlers']['external_logger']['address']):
|
||||
return
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user