From 7608cc1112eeda9cb6b5f0d1a9c8dd11f9b2cb17 Mon Sep 17 00:00:00 2001 From: hangy Date: Wed, 26 Sep 2018 14:49:55 +0200 Subject: [PATCH] Log the Log4Perl output to a sidecar container to make it available to Kubernetes.ton --- docker/kubernetes/backend-conf.yaml | 2 +- docker/kubernetes/backend-deployment.yaml | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/docker/kubernetes/backend-conf.yaml b/docker/kubernetes/backend-conf.yaml index 8e3a363ab9b07..2d898d7847474 100644 --- a/docker/kubernetes/backend-conf.yaml +++ b/docker/kubernetes/backend-conf.yaml @@ -399,7 +399,7 @@ data: log4perl.rootLogger=TRACE, LOGFILE log4perl.appender.LOGFILE=Log::Log4perl::Appender::File - log4perl.appender.LOGFILE.filename=/mnt/podata/logs/log4perl.log + log4perl.appender.LOGFILE.filename=/var/log/log4perl.log log4perl.appender.LOGFILE.mode=append log4perl.appender.LOGFILE.layout=PatternLayout diff --git a/docker/kubernetes/backend-deployment.yaml b/docker/kubernetes/backend-deployment.yaml index 53a856a83de61..970082bcf2d2a 100644 --- a/docker/kubernetes/backend-deployment.yaml +++ b/docker/kubernetes/backend-deployment.yaml @@ -34,6 +34,8 @@ spec: mountPath: "/opt/product-opener/html/images/products/" - name: data mountPath: "/mnt/podata/" + - name: varlog + mountPath: "/var/log" containers: - name: po-backend image: openfoodfacts/productopener-backend @@ -56,6 +58,14 @@ spec: mountPath: "/opt/product-opener/html/images/products/" - name: data mountPath: "/mnt/podata/" + - name: varlog + mountPath: "/var/log" + - name: po-backend-log4perl + image: busybox + volumeMounts: + - name: varlog + mountPath: "/var/log" + args: [/bin/sh, -c, 'tail -n+1 -f /var/log/log4perl.log'] volumes: - name: backend-config configMap: @@ -66,3 +76,5 @@ spec: - name: data persistentVolumeClaim: claimName: po-data + - name: varlog + emptyDir: {}