configmap-agent.yaml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. ---
  2. # Source: opentelemetry-collector/templates/configmap-agent.yaml
  3. apiVersion: v1
  4. kind: ConfigMap
  5. metadata:
  6. name: example-opentelemetry-collector-agent
  7. labels:
  8. helm.sh/chart: opentelemetry-collector-0.50.1
  9. app.kubernetes.io/name: opentelemetry-collector
  10. app.kubernetes.io/instance: example
  11. app.kubernetes.io/version: "0.73.0"
  12. app.kubernetes.io/managed-by: Helm
  13. data:
  14. relay: |
  15. exporters:
  16. logging: {}
  17. extensions:
  18. health_check: {}
  19. memory_ballast:
  20. size_in_percentage: 40
  21. processors:
  22. batch: {}
  23. memory_limiter:
  24. check_interval: 5s
  25. limit_percentage: 80
  26. spike_limit_percentage: 25
  27. receivers:
  28. filelog:
  29. exclude: []
  30. include:
  31. - /var/log/pods/*/*/*.log
  32. include_file_name: false
  33. include_file_path: true
  34. operators:
  35. - id: get-format
  36. routes:
  37. - expr: body matches "^\\{"
  38. output: parser-docker
  39. - expr: body matches "^[^ Z]+ "
  40. output: parser-crio
  41. - expr: body matches "^[^ Z]+Z"
  42. output: parser-containerd
  43. type: router
  44. - id: parser-crio
  45. output: extract_metadata_from_filepath
  46. regex: ^(?P<time>[^ Z]+) (?P<stream>stdout|stderr) (?P<logtag>[^ ]*) ?(?P<log>.*)$
  47. timestamp:
  48. layout: "2006-01-02T15:04:05.000000000-07:00"
  49. layout_type: gotime
  50. parse_from: attributes.time
  51. type: regex_parser
  52. - id: parser-containerd
  53. output: extract_metadata_from_filepath
  54. regex: ^(?P<time>[^ ^Z]+Z) (?P<stream>stdout|stderr) (?P<logtag>[^ ]*) ?(?P<log>.*)$
  55. timestamp:
  56. layout: '%Y-%m-%dT%H:%M:%S.%LZ'
  57. parse_from: attributes.time
  58. type: regex_parser
  59. - id: parser-docker
  60. output: extract_metadata_from_filepath
  61. timestamp:
  62. layout: '%Y-%m-%dT%H:%M:%S.%LZ'
  63. parse_from: attributes.time
  64. type: json_parser
  65. - id: extract_metadata_from_filepath
  66. parse_from: attributes["log.file.path"]
  67. regex: ^.*\/(?P<namespace>[^_]+)_(?P<pod_name>[^_]+)_(?P<uid>[a-f0-9\-]+)\/(?P<container_name>[^\._]+)\/(?P<restart_count>\d+)\.log$
  68. type: regex_parser
  69. - from: attributes.stream
  70. to: attributes["log.iostream"]
  71. type: move
  72. - from: attributes.container_name
  73. to: resource["k8s.container.name"]
  74. type: move
  75. - from: attributes.namespace
  76. to: resource["k8s.namespace.name"]
  77. type: move
  78. - from: attributes.pod_name
  79. to: resource["k8s.pod.name"]
  80. type: move
  81. - from: attributes.restart_count
  82. to: resource["k8s.container.restart_count"]
  83. type: move
  84. - from: attributes.uid
  85. to: resource["k8s.pod.uid"]
  86. type: move
  87. - from: attributes.log
  88. to: body
  89. type: move
  90. start_at: beginning
  91. jaeger:
  92. protocols:
  93. grpc:
  94. endpoint: ${MY_POD_IP}:14250
  95. thrift_compact:
  96. endpoint: ${MY_POD_IP}:6831
  97. thrift_http:
  98. endpoint: ${MY_POD_IP}:14268
  99. otlp:
  100. protocols:
  101. grpc:
  102. endpoint: ${MY_POD_IP}:4317
  103. http:
  104. endpoint: ${MY_POD_IP}:4318
  105. prometheus:
  106. config:
  107. scrape_configs:
  108. - job_name: opentelemetry-collector
  109. scrape_interval: 10s
  110. static_configs:
  111. - targets:
  112. - ${MY_POD_IP}:8888
  113. zipkin:
  114. endpoint: ${MY_POD_IP}:9411
  115. service:
  116. extensions:
  117. - health_check
  118. - memory_ballast
  119. pipelines:
  120. logs:
  121. exporters:
  122. - logging
  123. processors:
  124. - memory_limiter
  125. - batch
  126. receivers:
  127. - otlp
  128. - filelog
  129. metrics:
  130. exporters:
  131. - logging
  132. processors:
  133. - memory_limiter
  134. - batch
  135. receivers:
  136. - otlp
  137. - prometheus
  138. traces:
  139. exporters:
  140. - logging
  141. processors:
  142. - memory_limiter
  143. - batch
  144. receivers:
  145. - otlp
  146. - jaeger
  147. - zipkin
  148. telemetry:
  149. metrics:
  150. address: ${MY_POD_IP}:8888