|
| 1 | +# Sync with: |
| 2 | +# https://raw.githubusercontent.com/fluent/fluentd-kubernetes-daemonset/master/docker-image/v1.2/debian-elasticsearch/conf/kubernetes.conf |
| 3 | + |
| 4 | +# Parse /var/log/containers/*.log using Docker (JSON) or CRI-O (text) format. |
| 5 | +# Docker always logs full lines. CRI-O may log full (F) or partial (P) lines. |
| 6 | +<source> |
| 7 | + @type tail |
| 8 | + @id in_tail_container_logs |
| 9 | + path /var/log/containers/*.log |
| 10 | + pos_file /var/log/{{.ID}}-fluentd-containers.log.pos |
| 11 | + tag kubernetes.* |
| 12 | + read_from_head true |
| 13 | + <parse> |
| 14 | + @type multi_format |
| 15 | + <pattern> |
| 16 | + format json |
| 17 | + time_format %Y-%m-%dT%H:%M:%S.%NZ |
| 18 | + </pattern> |
| 19 | + <pattern> |
| 20 | + format regexp |
| 21 | + expression /^(?<time>.+) (?<stream>stdout|stderr) (?<partialflag>F|P) (?<log>.*)$/ |
| 22 | + time_format %Y-%m-%dT%H:%M:%S.%N%:z |
| 23 | + </pattern> |
| 24 | + </parse> |
| 25 | +</source> |
| 26 | + |
| 27 | +<source> |
| 28 | + @type tail |
| 29 | + @id in_tail_startupscript |
| 30 | + path /var/log/startupscript.log |
| 31 | + pos_file /var/log/{{.ID}}-fluentd-startupscript.log.pos |
| 32 | + tag startupscript |
| 33 | + <parse> |
| 34 | + @type syslog |
| 35 | + </parse> |
| 36 | +</source> |
| 37 | + |
| 38 | +<source> |
| 39 | + @type tail |
| 40 | + @id in_tail_docker |
| 41 | + path /var/log/docker.log |
| 42 | + pos_file /var/log/{{.ID}}-fluentd-docker.log.pos |
| 43 | + tag docker |
| 44 | + <parse> |
| 45 | + @type regexp |
| 46 | + expression /^time="(?<time>[^)]*)" level=(?<severity>[^ ]*) msg="(?<message>[^"]*)"( err="(?<error>[^"]*)")?( statusCode=($<status_code>\d+))?/ |
| 47 | + </parse> |
| 48 | +</source> |
| 49 | + |
| 50 | +<source> |
| 51 | + @type tail |
| 52 | + @id in_tail_etcd |
| 53 | + path /var/log/etcd.log |
| 54 | + pos_file /var/log/{{.ID}}-fluentd-etcd.log.pos |
| 55 | + tag k8s.etcd |
| 56 | + <parse> |
| 57 | + @type none |
| 58 | + </parse> |
| 59 | +</source> |
| 60 | + |
| 61 | +<source> |
| 62 | + @type tail |
| 63 | + @id in_tail_kubelet |
| 64 | + multiline_flush_interval 5s |
| 65 | + path /var/log/kubelet.log |
| 66 | + pos_file /var/log/{{.ID}}-fluentd-kubelet.log.pos |
| 67 | + tag k8s.kubelet |
| 68 | + <parse> |
| 69 | + @type kubernetes |
| 70 | + </parse> |
| 71 | +</source> |
| 72 | + |
| 73 | +<source> |
| 74 | + @type tail |
| 75 | + @id in_tail_kube_proxy |
| 76 | + multiline_flush_interval 5s |
| 77 | + path /var/log/kube-proxy.log |
| 78 | + pos_file /var/log/{{.ID}}-fluentd-kube-proxy.log.pos |
| 79 | + tag k8s.kube-proxy |
| 80 | + <parse> |
| 81 | + @type kubernetes |
| 82 | + </parse> |
| 83 | +</source> |
| 84 | + |
| 85 | +<source> |
| 86 | + @type tail |
| 87 | + @id in_tail_kube_apiserver |
| 88 | + multiline_flush_interval 5s |
| 89 | + path /var/log/kube-apiserver.log |
| 90 | + pos_file /var/log/{{.ID}}-fluentd-kube-apiserver.log.pos |
| 91 | + tag k8s.kube-apiserver |
| 92 | + <parse> |
| 93 | + @type kubernetes |
| 94 | + </parse> |
| 95 | +</source> |
| 96 | + |
| 97 | +<source> |
| 98 | + @type tail |
| 99 | + @id in_tail_kube_controller_manager |
| 100 | + multiline_flush_interval 5s |
| 101 | + path /var/log/kube-controller-manager.log |
| 102 | + pos_file /var/log/{{.ID}}-fluentd-kube-controller-manager.log.pos |
| 103 | + tag k8s.kube-controller-manager |
| 104 | + <parse> |
| 105 | + @type kubernetes |
| 106 | + </parse> |
| 107 | +</source> |
| 108 | + |
| 109 | +<source> |
| 110 | + @type tail |
| 111 | + @id in_tail_kube_scheduler |
| 112 | + multiline_flush_interval 5s |
| 113 | + path /var/log/kube-scheduler.log |
| 114 | + pos_file /var/log/{{.ID}}-fluentd-kube-scheduler.log.pos |
| 115 | + tag k8s.kube-scheduler |
| 116 | + <parse> |
| 117 | + @type kubernetes |
| 118 | + </parse> |
| 119 | +</source> |
| 120 | + |
| 121 | +<source> |
| 122 | + @type tail |
| 123 | + @id in_tail_rescheduler |
| 124 | + multiline_flush_interval 5s |
| 125 | + path /var/log/rescheduler.log |
| 126 | + pos_file /var/log/{{.ID}}-fluentd-rescheduler.log.pos |
| 127 | + tag k8s.rescheduler |
| 128 | + <parse> |
| 129 | + @type kubernetes |
| 130 | + </parse> |
| 131 | +</source> |
| 132 | + |
| 133 | +<source> |
| 134 | + @type tail |
| 135 | + @id in_tail_glbc |
| 136 | + multiline_flush_interval 5s |
| 137 | + path /var/log/glbc.log |
| 138 | + pos_file /var/log/{{.ID}}-fluentd-glbc.log.pos |
| 139 | + tag k8s.glbc |
| 140 | + <parse> |
| 141 | + @type kubernetes |
| 142 | + </parse> |
| 143 | +</source> |
| 144 | + |
| 145 | +<source> |
| 146 | + @type tail |
| 147 | + @id in_tail_cluster_autoscaler |
| 148 | + multiline_flush_interval 5s |
| 149 | + path /var/log/cluster-autoscaler.log |
| 150 | + pos_file /var/log/{{.ID}}-fluentd-cluster-autoscaler.log.pos |
| 151 | + tag k8s.cluster-autoscaler |
| 152 | + <parse> |
| 153 | + @type kubernetes |
| 154 | + </parse> |
| 155 | +</source> |
| 156 | + |
| 157 | +# Example: |
| 158 | +# 2017-02-09T00:15:57.992775796Z AUDIT: id="90c73c7c-97d6-4b65-9461-f94606ff825f" ip="104.132.1.72" method="GET" user="kubecfg" as="<self>" asgroups="<lookup>" namespace="default" uri="/api/v1/namespaces/default/pods" |
| 159 | +# 2017-02-09T00:15:57.993528822Z AUDIT: id="90c73c7c-97d6-4b65-9461-f94606ff825f" response="200" |
| 160 | +<source> |
| 161 | + @type tail |
| 162 | + @id in_tail_kube_apiserver_audit |
| 163 | + multiline_flush_interval 5s |
| 164 | + path /var/log/kubernetes/kube-apiserver-audit.log |
| 165 | + pos_file /var/log/{{.ID}}-kube-apiserver-audit.log.pos |
| 166 | + tag k8s.kube-apiserver-audit |
| 167 | + <parse> |
| 168 | + @type multiline |
| 169 | + format_firstline /^\S+\s+AUDIT:/ |
| 170 | + # Fields must be explicitly captured by name to be parsed into the record. |
| 171 | + # Fields may not always be present, and order may change, so this just looks |
| 172 | + # for a list of key="\"quoted\" value" pairs separated by spaces. |
| 173 | + # Unknown fields are ignored. |
| 174 | + # Note: We can't separate query/response lines as format1/format2 because |
| 175 | + # they don't always come one after the other for a given query. |
| 176 | + format1 /^(?<time>\S+) AUDIT:(?: (?:id="(?<id>(?:[^"\\]|\\.)*)"|ip="(?<ip>(?:[^"\\]|\\.)*)"|method="(?<method>(?:[^"\\]|\\.)*)"|user="(?<user>(?:[^"\\]|\\.)*)"|groups="(?<groups>(?:[^"\\]|\\.)*)"|as="(?<as>(?:[^"\\]|\\.)*)"|asgroups="(?<asgroups>(?:[^"\\]|\\.)*)"|namespace="(?<namespace>(?:[^"\\]|\\.)*)"|uri="(?<uri>(?:[^"\\]|\\.)*)"|response="(?<response>(?:[^"\\]|\\.)*)"|\w+="(?:[^"\\]|\\.)*"))*/ |
| 177 | + time_format %Y-%m-%dT%T.%L%Z |
| 178 | + </parse> |
| 179 | +</source> |
| 180 | + |
| 181 | +<filter kubernetes.**> |
| 182 | + @type kubernetes_metadata |
| 183 | + @id filter_kube_metadata |
| 184 | +</filter> |
0 commit comments