add 'include_timestamp true' in the elastic part of the configmap to actually get the timestamp in elasticsearch

This commit is contained in:
Schirrms 2022-12-08 13:16:12 +01:00
parent 022ec40bef
commit e1209446e3
3 changed files with 20 additions and 3 deletions

View File

@ -0,0 +1,14 @@
---
apiVersion: v1
kind: Pod
metadata:
name: counter-err
labels:
app: counter-err
version: v1.2
spec:
containers:
- name: count
image: busybox
args: [/bin/sh, -c,
'i=0; RANDOM=$$; while true; do R=$(($RANDOM%100)); echo "loop:$i value:$R"; if [ $R -gt 80 ]; then echo "Warning:$R too high" 1>&2; fi; i=$((i+1)); sleep 1; done']

View File

@ -33,10 +33,12 @@ RUN touch /fluentd/etc/disable.conf
# Copy plugins # Copy plugins
COPY plugins /fluentd/plugins/ COPY plugins /fluentd/plugins/
COPY entrypoint.sh /fluentd/entrypoint.sh COPY entrypoint.sh /fluentd/entrypoint.sh
# chmod needed in full Linux env :)
RUN chmod 755 /fluentd/entrypoint.sh
# Environment variables # Environment variables
ENV FLUENTD_OPT="" ENV FLUENTD_OPT=""
ENV FLUENTD_CONF="fluent.conf" ENV FLUENTD_CONF="fluent.conf"
# Overwrite ENTRYPOINT to run fluentd as root for /var/log / /var/lib # Overwrite ENTRYPOINT to run fluentd as root for /var/log / /var/lib
ENTRYPOINT ["tini", "--", "/fluentd/entrypoint.sh"] ENTRYPOINT ["tini", "--", "/fluentd/entrypoint.sh"]

View File

@ -51,7 +51,7 @@ data:
<parse> <parse>
@type kubernetes @type kubernetes
@type "#{ENV['FLUENT_CONTAINER_TAIL_PARSER_TYPE'] || 'json'}" @type "#{ENV['FLUENT_CONTAINER_TAIL_PARSER_TYPE'] || 'json'}"
time_format %Y-%m-%dT%H:%M:%S.%NZ time_format "%Y-%m-%dT%H:%M:%S.%NZ"
</parse> </parse>
</source> </source>
@ -78,4 +78,5 @@ data:
port "#{ENV['FLUENT_ELASTICSEARCH_PORT'] || '9200'}" port "#{ENV['FLUENT_ELASTICSEARCH_PORT'] || '9200'}"
index_name fluentd-k8s index_name fluentd-k8s
type_name fluentd type_name fluentd
</match> include_timestamp true
</match>