From 281b0799f07d72cde173e4a040dd059064a1a668 Mon Sep 17 00:00:00 2001 From: Steve Wilkerson Date: Wed, 19 Dec 2018 16:54:04 -0600 Subject: [PATCH] Write libvirt logs to host This modifies the libvirt chart to write logs directly to the host by default. This also modifies the fluentbit and fluentd charts to capture libvirt logs from the host and index them into Elasticsearch Change-Id: I0bbc49d2c0d4cf4895f797e48f309f308ffd021f --- fluent-logging/values.yaml | 31 ++++++++++++++++++++++++ libvirt/templates/daemonset-libvirt.yaml | 5 ++++ libvirt/values.yaml | 1 + 3 files changed, 37 insertions(+) diff --git a/fluent-logging/values.yaml b/fluent-logging/values.yaml index ae431afafa..bd26187333 100644 --- a/fluent-logging/values.yaml +++ b/fluent-logging/values.yaml @@ -120,6 +120,16 @@ conf: DB.Sync: Normal Buffer_Chunk_Size: 1M Buffer_Max_Size: 1M + - libvirt: + header: input + Name: tail + Tag: libvirt + Path: /var/log/libvirt/libvirtd.log + DB: /var/log/libvirt.db + Mem_Buf_Limit: 5MB + DB.Sync: Normal + Buffer_Chunk_Size: 1M + Buffer_Max_Size: 1M - kubelet: header: input Name: systemd @@ -142,6 +152,11 @@ conf: DB.Sync: Normal Buffer_Chunk_Size: 1M Buffer_Max_Size: 1M + - libvirt_record_modifier: + header: filter + Name: record_modifier + Match: libvirt + Record: hostname ${HOSTNAME} - kernel_record_modifier: header: filter Name: record_modifier @@ -318,6 +333,22 @@ conf: key: application pattern: rabbitmq tag: auth.${tag} + - libvirt_elasticsearch: + header: match + type: elasticsearch + user: "#{ENV['ELASTICSEARCH_USERNAME']}" + password: "#{ENV['ELASTICSEARCH_PASSWORD']}" + expression: "libvirt" + include_tag_key: true + host: "#{ENV['ELASTICSEARCH_HOST']}" + port: "#{ENV['ELASTICSEARCH_PORT']}" + logstash_format: true + logstash_prefix: libvirt + buffer_chunk_limit: 2M + buffer_queue_limit: 8 + flush_interval: "5" + max_retry_wait: 300 + disable_retry_limit: "" - journal_elasticsearch: header: match type: elasticsearch diff --git a/libvirt/templates/daemonset-libvirt.yaml b/libvirt/templates/daemonset-libvirt.yaml index ec354f8216..b975b8de9c 100644 --- a/libvirt/templates/daemonset-libvirt.yaml +++ b/libvirt/templates/daemonset-libvirt.yaml @@ -166,6 +166,8 @@ spec: mountPath: /dev - name: cgroup mountPath: /sys/fs/cgroup + - name: logs + mountPath: /var/log/libvirt - name: machine-id mountPath: /etc/machine-id readOnly: true @@ -221,6 +223,9 @@ spec: - name: dev hostPath: path: /dev + - name: logs + hostPath: + path: /var/log/libvirt - name: cgroup hostPath: path: /sys/fs/cgroup diff --git a/libvirt/values.yaml b/libvirt/values.yaml index b2551d86a2..1a11193e16 100644 --- a/libvirt/values.yaml +++ b/libvirt/values.yaml @@ -82,6 +82,7 @@ conf: ca_file: "" listen_addr: 127.0.0.1 log_level: "3" + log_outputs: "1:file:/var/log/libvirt/libvirtd.log" qemu: stdio_handler: "file" user: "nova"