Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions k8s-logging-cfg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: logging-cfg
namespace: default
data:
filebeat.yml: |
filebeat.registry_file: /var/log/containers/filebeat_registry

filebeat.prospectors:
- input_type: log
paths:
- "/var/lib/docker/containers/*/*.log"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be /var/log/containers/*.log to get the metadata from filenames.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

symlinks: true
json.keys_under_root: true
json.add_error_key: true
json.message_key: log
multiline.pattern: '^\s'
multiline.match: after
document_type: kube-logs

output.logstash:
hosts: ${LOGSTASH_HOSTS:?No logstash host configured. Use env var LOGSTASH_HOSTS to set hosts.}
timeout: 15
# Available log levels are: critical, error, warning, info, debug
logging.level: info
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you take this config from filebeat.yml in the repo to keep it as default config?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

60 changes: 60 additions & 0 deletions k8s-logging-filebeat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: logging-filebeat
namespace: default
labels:
name: logging-filebeat
spec:
template:
metadata:
labels:
name: logging-filebeat
name: logging-filebeat
spec:
containers:
- name: filebeat
image: apsops/filebeat-kubernetes
env:
- name: LOGSTASH_HOSTS
value: logstash.default.svc.cluster.local:5044
resources:
requests:
cpu: 50m
memory: 50Mi
limits:
cpu: 50m
memory: 100Mi
securityContext:
privileged: true
runAsUser: 0
volumeMounts:
- name: config-volume
mountPath: /etc/filebeat
- name: varlogcontainers
mountPath: /var/log/containers
- name: varlogpods
mountPath: /var/log/pods
- name: varlibdockercontainers
mountPath: /var/lib/docker/containers
terminationGracePeriodSeconds: 30
volumes:
# mount /var/log/containers to get friendly named symlinks to actual logs
- name: varlogcontainers
hostPath:
path: /var/log/containers
# mount /var/log/pods as its where pod logs are collected
- name: varlogpods
hostPath:
path: /var/log/pods
# mount /var/lib/docker/containers which is where the logs _actually_ are
- name: varlibdockercontainers
hostPath:
path: /var/lib/docker/containers
# mount the configmap with the filebeat config file
- name: config-volume
configMap:
name: logging-cfg
items:
- key: filebeat.yml
path: filebeat.yml
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably better to update it in the README?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kube manifest file and the readme file is updated

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need to run this in privileged mode? And this is already in README, so you might as well remove this file.