Path: blob/main/examples/java/json-logging-ecs/k8s/collector-configmap.yaml
401 views
apiVersion: v11kind: ConfigMap2metadata:3name: otel-collector-config4data:5otel-collector-config.yaml: |-6receivers:7otlp:8protocols:9grpc:10endpoint: 0.0.0.0:431711http:12endpoint: 0.0.0.0:431813prometheus/collector: # needed if you use the docker-lgtm image14config:15scrape_configs:16- job_name: 'opentelemetry-collector'17static_configs:18- targets: [ 'localhost:8888' ]19filelog/json-ecs:20include:21- /var/log/pods/*/*/*.log22include_file_path: true23operators:24- id: container-parser25type: container26- id: router27type: router28routes:29- output: json_parser30expr: 'body matches "\\{[^{}]*\\}" == true'31- id: json_parser32type: json_parser33on_error: drop_quiet34body: attributes.message35timestamp:36parse_from: attributes["@timestamp"]37layout: '%Y-%m-%dT%H:%M:%S.%LZ'38severity:39parse_from: attributes["log.level"]40trace:41trace_id:42parse_from: attributes.trace_id43span_id:44parse_from: attributes.span_id45scope_name:46parse_from: attributes["log.logger"]47- id: move_service_namespace48type: move49if: 'attributes["service.namespace"] != nil'50from: attributes["service.namespace"]51to: resource["service.namespace"]52- id: move_service_name53type: move54from: attributes["service.name"]55to: resource["service.name"]56- id: move_service_instance_id57type: move58if: 'attributes["service.instance.id"] != nil'59from: attributes["service.instance.id"]60to: resource["service.instance.id"]61- id: move_deployment_environment62type: move63if: 'attributes["deployment.environment"] != nil'64from: attributes["deployment.environment"]65to: resource["deployment.environment"]66- id: move_thread_name67type: move68from: attributes["process.thread.name"]69to: attributes["thread.name"]70- id: move_error_message71type: move72if: 'attributes["error.message"] != nil'73from: attributes["error.message"]74to: attributes["exception.message"]75- id: move_error_type76type: move77if: 'attributes["error.type"] != nil'78from: attributes["error.type"]79to: attributes["exception.type"]80- id: move_throwable_stacktrace81type: move82if: 'len(attributes["error.stack_trace"]) > 0'83from: attributes["error.stack_trace"]84to: attributes["exception.stacktrace"]85- id: remove_logger_name86type: remove87field: attributes["log.logger"]88- id: remove_timestamp89type: remove90field: attributes["@timestamp"]91- id: remove_level92type: remove93field: attributes["log.level"]94- id: remove_span_id95if: 'attributes["span_id"] != nil'96type: remove97field: attributes.span_id98- id: remove_trace_id99if: 'attributes["trace_id"] != nil'100type: remove101field: attributes.trace_id102- id: remove_message103type: remove104field: attributes.message105- id: remove_ecs_version106type: remove107field: attributes["ecs.version"]108- id: remove_ecs_event_dataset109type: remove110field: attributes["event.dataset"]111- id: remove_trace_flags112type: remove113field: attributes["trace_flags"]114- id: remove_logtag115type: remove116field: attributes.logtag117- id: remove_file118type: remove119field: attributes["log.file.path"]120- id: remove_filename121type: remove122field: attributes["log.file.name"]123- id: remove_stream124type: remove125field: attributes["log.iostream"]126- id: remove_time127type: remove128field: attributes.time129130processors:131batch:132resourcedetection:133detectors: [ "env", "system" ]134override: false135136exporters:137otlphttp/metrics:138endpoint: http://localhost:9090/api/v1/otlp139otlphttp/traces:140endpoint: http://localhost:4418141otlphttp/logs:142endpoint: http://localhost:3100/otlp143debug/metrics:144verbosity: detailed145debug/traces:146verbosity: detailed147debug/logs:148verbosity: detailed149nop:150151service:152pipelines:153traces:154receivers: [ otlp ]155processors: [ batch ]156exporters: [ otlphttp/traces ]157metrics:158receivers: [ otlp, prometheus/collector ]159processors: [ batch ]160exporters: [ otlphttp/metrics ]161logs/otlp:162receivers: [ otlp ]163processors: [ batch ]164exporters: [ otlphttp/logs ]165logs/json-ecs:166receivers: [ filelog/json-ecs ]167processors: [ batch ]168exporters: [ otlphttp/logs ]169# exporters: [ otlphttp/logs, debug/logs ] # Uncomment this line to enable debug logging170171172173174