From e52cebc28e436a6c46ddd4a1a65a8046efed998d Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Thu, 9 Apr 2020 00:42:43 -0400 Subject: [PATCH] rsyslogd: use %rawmsg-after-pri% instead of %msg% after some prolonged RFC reading and tinkering w/ rsyslogd... cpython's SysLogHandler doesn't emit RFC3164 formatted messages in the format you'd expect; it's missing the ISO date, hostname, etc... along with other header values; the handler implementation relies on you to specify a syslog-like formatter (we've replaced all of this with our own *custom* logstash-esque formatter that effectively outputs valid JSON - without dates and other syslog header values prepended) because of this unanticipated format, rsyslogd chokes when trying to parse the message's parts; AWX is emitting: RAWJSON ...so the usage of `%msg%` isn't going to work for us, because rsyslog tries to parse *all* of the possible headers (and yells, because it can't find a date to parse): see: https://www.rsyslog.com/files/temp/doc-indent/configuration/properties.html#message-properties this is fine, because we don't *need* any of that message parsing anyways; in the end, we're *just* interested in forwarding the raw JSON/text content to the third party log handler --- .../kubernetes/templates/deployment.yml.j2 | 18 ------------------ .../roles/kubernetes/templates/rsyslog.yml.j2 | 14 -------------- 2 files changed, 32 deletions(-) delete mode 100644 installer/roles/kubernetes/templates/rsyslog.yml.j2 diff --git a/installer/roles/kubernetes/templates/deployment.yml.j2 b/installer/roles/kubernetes/templates/deployment.yml.j2 index 080a2ae80a..30afe9f0d5 100644 --- a/installer/roles/kubernetes/templates/deployment.yml.j2 +++ b/installer/roles/kubernetes/templates/deployment.yml.j2 @@ -98,8 +98,6 @@ spec: mountPath: "/var/run/supervisor" - name: rsyslog-socket mountPath: "/var/run/rsyslog" - - name: rsyslog-dir - mountPath: "/var/lib/awx/rsyslog/" {% if ca_trust_dir is defined %} - name: {{ kubernetes_deployment_name }}-ca-trust-dir mountPath: "/etc/pki/ca-trust/source/anchors/" @@ -148,11 +146,6 @@ spec: subPath: supervisor_task.conf readOnly: true - - name: {{ kubernetes_deployment_name }}-rsyslog-config - mountPath: "/var/lib/awx/rsyslog/rsyslog.conf" - subPath: rsyslog.conf - readOnly: true - - name: {{ kubernetes_deployment_name }}-secret-key mountPath: "/etc/tower/SECRET_KEY" subPath: SECRET_KEY @@ -189,8 +182,6 @@ spec: mountPath: "/var/run/supervisor" - name: rsyslog-socket mountPath: "/var/run/rsyslog" - - name: rsyslog-dir - mountPath: "/var/lib/awx/rsyslog/" {% if ca_trust_dir is defined %} - name: {{ kubernetes_deployment_name }}-ca-trust-dir mountPath: "/etc/pki/ca-trust/source/anchors/" @@ -336,8 +327,6 @@ spec: emptyDir: {} - name: rsyslog-socket emptyDir: {} - - name: rsyslog-dir - emptyDir: {} {% if ca_trust_dir is defined %} - name: {{ kubernetes_deployment_name }}-ca-trust-dir hostPath: @@ -414,13 +403,6 @@ spec: - key: supervisor-task-config path: 'supervisor_task.conf' - - name: {{ kubernetes_deployment_name }}-rsyslog-config - configMap: - name: {{ kubernetes_deployment_name }}-rsyslog-config - items: - - key: rsyslog-config - path: 'rsyslog.conf' - - name: {{ kubernetes_deployment_name }}-secret-key secret: secretName: "{{ kubernetes_deployment_name }}-secrets" diff --git a/installer/roles/kubernetes/templates/rsyslog.yml.j2 b/installer/roles/kubernetes/templates/rsyslog.yml.j2 deleted file mode 100644 index 3a047b4c1f..0000000000 --- a/installer/roles/kubernetes/templates/rsyslog.yml.j2 +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ kubernetes_deployment_name }}-rsyslog-config - namespace: {{ kubernetes_namespace }} -data: - rsyslog-config: | - $WorkDirectory /var/lib/awx/rsyslog - $MaxMessageSize 700000 - $IncludeConfig /var/lib/awx/rsyslog/conf.d/*.conf - $ModLoad imuxsock - input(type="imuxsock" Socket="/var/run/rsyslog/rsyslog.sock" unlink="on") - template(name="awx" type="string" string="%msg%") - action(type="omfile" file="/dev/null")