fluentd-es-configmap.yaml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. kind: ConfigMap
  2. apiVersion: v1
  3. metadata:
  4. name: fluentd-es-config-v0.2.1
  5. namespace: logging
  6. labels:
  7. addonmanager.kubernetes.io/mode: Reconcile
  8. data:
  9. system.conf: |-
  10. <system>
  11. root_dir /tmp/fluentd-buffers/
  12. </system>
  13. containers.input.conf: |-
  14. <source>
  15. @id fluentd-containers.log
  16. @type tail
  17. path /var/log/containers/*.log
  18. pos_file /var/log/es-containers.log.pos
  19. tag raw.kubernetes.*
  20. read_from_head true
  21. <parse>
  22. @type multi_format
  23. <pattern>
  24. format json
  25. time_key time
  26. time_format %Y-%m-%dT%H:%M:%S.%NZ
  27. </pattern>
  28. <pattern>
  29. format /^(?<time>.+) (?<stream>stdout|stderr) [^ ]* (?<log>.*)$/
  30. time_format %Y-%m-%dT%H:%M:%S.%N%:z
  31. </pattern>
  32. </parse>
  33. </source>
  34. # Detect exceptions in the log output and forward them as one log entry.
  35. <match raw.kubernetes.**>
  36. @id raw.kubernetes
  37. @type detect_exceptions
  38. remove_tag_prefix raw
  39. message log
  40. stream stream
  41. multiline_flush_interval 5
  42. max_bytes 500000
  43. max_lines 1000
  44. </match>
  45. # Concatenate multi-line logs
  46. <filter **>
  47. @id filter_concat
  48. @type concat
  49. key message
  50. multiline_end_regexp /\n$/
  51. separator ""
  52. </filter>
  53. # Enriches records with Kubernetes metadata
  54. <filter kubernetes.**>
  55. @id filter_kubernetes_metadata
  56. @type kubernetes_metadata
  57. </filter>
  58. # Fixes json fields in Elasticsearch
  59. <filter kubernetes.**>
  60. @id filter_parser
  61. @type parser
  62. key_name log
  63. reserve_data true
  64. remove_key_name_field true
  65. <parse>
  66. @type multi_format
  67. <pattern>
  68. format json
  69. </pattern>
  70. <pattern>
  71. format none
  72. </pattern>
  73. </parse>
  74. </filter>
  75. system.input.conf: |-
  76. # Example:
  77. # 2015-12-21 23:17:22,066 [salt.state ][INFO ] Completed state [net.ipv4.ip_forward] at time 23:17:22.066081
  78. <source>
  79. @id minion
  80. @type tail
  81. format /^(?<time>[^ ]* [^ ,]*)[^\[]*\[[^\]]*\]\[(?<severity>[^ \]]*) *\] (?<message>.*)$/
  82. time_format %Y-%m-%d %H:%M:%S
  83. path /var/log/salt/minion
  84. pos_file /var/log/salt.pos
  85. tag salt
  86. </source>
  87. # Example:
  88. # Dec 21 23:17:22 gke-foo-1-1-4b5cbd14-node-4eoj startupscript: Finished running startup script /var/run/google.startup.script
  89. <source>
  90. @id startupscript.log
  91. @type tail
  92. format syslog
  93. path /var/log/startupscript.log
  94. pos_file /var/log/es-startupscript.log.pos
  95. tag startupscript
  96. </source>
  97. # Examples:
  98. # time="2016-02-04T06:51:03.053580605Z" level=info msg="GET /containers/json"
  99. # time="2016-02-04T07:53:57.505612354Z" level=error msg="HTTP Error" err="No such image: -f" statusCode=404
  100. # TODO(random-liu): Remove this after cri container runtime rolls out.
  101. <source>
  102. @id docker.log
  103. @type tail
  104. format /^time="(?<time>[^"]*)" level=(?<severity>[^ ]*) msg="(?<message>[^"]*)"( err="(?<error>[^"]*)")?( statusCode=($<status_code>\d+))?/
  105. path /var/log/docker.log
  106. pos_file /var/log/es-docker.log.pos
  107. tag docker
  108. </source>
  109. # Example:
  110. # 2016/02/04 06:52:38 filePurge: successfully removed file /var/etcd/data/member/wal/00000000000006d0-00000000010a23d1.wal
  111. <source>
  112. @id etcd.log
  113. @type tail
  114. # Not parsing this, because it doesn't have anything particularly useful to
  115. # parse out of it (like severities).
  116. format none
  117. path /var/log/etcd.log
  118. pos_file /var/log/es-etcd.log.pos
  119. tag etcd
  120. </source>
  121. # Multi-line parsing is required for all the kube logs because very large log
  122. # statements, such as those that include entire object bodies, get split into
  123. # multiple lines by glog.
  124. # Example:
  125. # I0204 07:32:30.020537 3368 server.go:1048] POST /stats/container/: (13.972191ms) 200 [[Go-http-client/1.1] 10.244.1.3:40537]
  126. <source>
  127. @id kubelet.log
  128. @type tail
  129. format multiline
  130. multiline_flush_interval 5s
  131. format_firstline /^\w\d{4}/
  132. format1 /^(?<severity>\w)(?<time>\d{4} [^\s]*)\s+(?<pid>\d+)\s+(?<source>[^ \]]+)\] (?<message>.*)/
  133. time_format %m%d %H:%M:%S.%N
  134. path /var/log/kubelet.log
  135. pos_file /var/log/es-kubelet.log.pos
  136. tag kubelet
  137. </source>
  138. # Example:
  139. # I1118 21:26:53.975789 6 proxier.go:1096] Port "nodePort for kube-system/default-http-backend:http" (:31429/tcp) was open before and is still needed
  140. <source>
  141. @id kube-proxy.log
  142. @type tail
  143. format multiline
  144. multiline_flush_interval 5s
  145. format_firstline /^\w\d{4}/
  146. format1 /^(?<severity>\w)(?<time>\d{4} [^\s]*)\s+(?<pid>\d+)\s+(?<source>[^ \]]+)\] (?<message>.*)/
  147. time_format %m%d %H:%M:%S.%N
  148. path /var/log/kube-proxy.log
  149. pos_file /var/log/es-kube-proxy.log.pos
  150. tag kube-proxy
  151. </source>
  152. # Example:
  153. # I0204 07:00:19.604280 5 handlers.go:131] GET /api/v1/nodes: (1.624207ms) 200 [[kube-controller-manager/v1.1.3 (linux/amd64) kubernetes/6a81b50] 127.0.0.1:38266]
  154. <source>
  155. @id kube-apiserver.log
  156. @type tail
  157. format multiline
  158. multiline_flush_interval 5s
  159. format_firstline /^\w\d{4}/
  160. format1 /^(?<severity>\w)(?<time>\d{4} [^\s]*)\s+(?<pid>\d+)\s+(?<source>[^ \]]+)\] (?<message>.*)/
  161. time_format %m%d %H:%M:%S.%N
  162. path /var/log/kube-apiserver.log
  163. pos_file /var/log/es-kube-apiserver.log.pos
  164. tag kube-apiserver
  165. </source>
  166. # Example:
  167. # I0204 06:55:31.872680 5 servicecontroller.go:277] LB already exists and doesn't need update for service kube-system/kube-ui
  168. <source>
  169. @id kube-controller-manager.log
  170. @type tail
  171. format multiline
  172. multiline_flush_interval 5s
  173. format_firstline /^\w\d{4}/
  174. format1 /^(?<severity>\w)(?<time>\d{4} [^\s]*)\s+(?<pid>\d+)\s+(?<source>[^ \]]+)\] (?<message>.*)/
  175. time_format %m%d %H:%M:%S.%N
  176. path /var/log/kube-controller-manager.log
  177. pos_file /var/log/es-kube-controller-manager.log.pos
  178. tag kube-controller-manager
  179. </source>
  180. # Example:
  181. # W0204 06:49:18.239674 7 reflector.go:245] pkg/scheduler/factory/factory.go:193: watch of *api.Service ended with: 401: The event in requested index is outdated and cleared (the requested history has been cleared [2578313/2577886]) [2579312]
  182. <source>
  183. @id kube-scheduler.log
  184. @type tail
  185. format multiline
  186. multiline_flush_interval 5s
  187. format_firstline /^\w\d{4}/
  188. format1 /^(?<severity>\w)(?<time>\d{4} [^\s]*)\s+(?<pid>\d+)\s+(?<source>[^ \]]+)\] (?<message>.*)/
  189. time_format %m%d %H:%M:%S.%N
  190. path /var/log/kube-scheduler.log
  191. pos_file /var/log/es-kube-scheduler.log.pos
  192. tag kube-scheduler
  193. </source>
  194. # Example:
  195. # I0603 15:31:05.793605 6 cluster_manager.go:230] Reading config from path /etc/gce.conf
  196. <source>
  197. @id glbc.log
  198. @type tail
  199. format multiline
  200. multiline_flush_interval 5s
  201. format_firstline /^\w\d{4}/
  202. format1 /^(?<severity>\w)(?<time>\d{4} [^\s]*)\s+(?<pid>\d+)\s+(?<source>[^ \]]+)\] (?<message>.*)/
  203. time_format %m%d %H:%M:%S.%N
  204. path /var/log/glbc.log
  205. pos_file /var/log/es-glbc.log.pos
  206. tag glbc
  207. </source>
  208. # Example:
  209. # I0603 15:31:05.793605 6 cluster_manager.go:230] Reading config from path /etc/gce.conf
  210. <source>
  211. @id cluster-autoscaler.log
  212. @type tail
  213. format multiline
  214. multiline_flush_interval 5s
  215. format_firstline /^\w\d{4}/
  216. format1 /^(?<severity>\w)(?<time>\d{4} [^\s]*)\s+(?<pid>\d+)\s+(?<source>[^ \]]+)\] (?<message>.*)/
  217. time_format %m%d %H:%M:%S.%N
  218. path /var/log/cluster-autoscaler.log
  219. pos_file /var/log/es-cluster-autoscaler.log.pos
  220. tag cluster-autoscaler
  221. </source>
  222. # Logs from systemd-journal for interesting services.
  223. # TODO(random-liu): Remove this after cri container runtime rolls out.
  224. <source>
  225. @id journald-docker
  226. @type systemd
  227. matches [{ "_SYSTEMD_UNIT": "docker.service" }]
  228. <storage>
  229. @type local
  230. persistent true
  231. path /var/log/journald-docker.pos
  232. </storage>
  233. read_from_head true
  234. tag docker
  235. </source>
  236. <source>
  237. @id journald-container-runtime
  238. @type systemd
  239. matches [{ "_SYSTEMD_UNIT": "{{ fluentd_container_runtime_service }}.service" }]
  240. <storage>
  241. @type local
  242. persistent true
  243. path /var/log/journald-container-runtime.pos
  244. </storage>
  245. read_from_head true
  246. tag container-runtime
  247. </source>
  248. <source>
  249. @id journald-kubelet
  250. @type systemd
  251. matches [{ "_SYSTEMD_UNIT": "kubelet.service" }]
  252. <storage>
  253. @type local
  254. persistent true
  255. path /var/log/journald-kubelet.pos
  256. </storage>
  257. read_from_head true
  258. tag kubelet
  259. </source>
  260. <source>
  261. @id journald-node-problem-detector
  262. @type systemd
  263. matches [{ "_SYSTEMD_UNIT": "node-problem-detector.service" }]
  264. <storage>
  265. @type local
  266. persistent true
  267. path /var/log/journald-node-problem-detector.pos
  268. </storage>
  269. read_from_head true
  270. tag node-problem-detector
  271. </source>
  272. <source>
  273. @id kernel
  274. @type systemd
  275. matches [{ "_TRANSPORT": "kernel" }]
  276. <storage>
  277. @type local
  278. persistent true
  279. path /var/log/kernel.pos
  280. </storage>
  281. <entry>
  282. fields_strip_underscores true
  283. fields_lowercase true
  284. </entry>
  285. read_from_head true
  286. tag kernel
  287. </source>
  288. forward.input.conf: |-
  289. # Takes the messages sent over TCP
  290. <source>
  291. @id forward
  292. @type forward
  293. </source>
  294. monitoring.conf: |-
  295. # Prometheus Exporter Plugin
  296. # input plugin that exports metrics
  297. <source>
  298. @id prometheus
  299. @type prometheus
  300. </source>
  301. <source>
  302. @id monitor_agent
  303. @type monitor_agent
  304. </source>
  305. # input plugin that collects metrics from MonitorAgent
  306. <source>
  307. @id prometheus_monitor
  308. @type prometheus_monitor
  309. <labels>
  310. host ${hostname}
  311. </labels>
  312. </source>
  313. # input plugin that collects metrics for output plugin
  314. <source>
  315. @id prometheus_output_monitor
  316. @type prometheus_output_monitor
  317. <labels>
  318. host ${hostname}
  319. </labels>
  320. </source>
  321. # input plugin that collects metrics for in_tail plugin
  322. <source>
  323. @id prometheus_tail_monitor
  324. @type prometheus_tail_monitor
  325. <labels>
  326. host ${hostname}
  327. </labels>
  328. </source>
  329. output.conf: |-
  330. <match **>
  331. @id elasticsearch
  332. @type elasticsearch
  333. @log_level info
  334. type_name _doc
  335. include_tag_key true
  336. host elasticsearch-logging
  337. port 9200
  338. logstash_format true
  339. <buffer>
  340. @type file
  341. path /var/log/fluentd-buffers/kubernetes.system.buffer
  342. flush_mode interval
  343. retry_type exponential_backoff
  344. flush_thread_count 2
  345. flush_interval 5s
  346. retry_forever
  347. retry_max_interval 30
  348. chunk_limit_size 2M
  349. total_limit_size 500M
  350. overflow_action block
  351. </buffer>
  352. </match>