Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aos
GitHub Repository: aos/docker-otel-lgtm
Path: blob/main/examples/java/json-logging-ecs/k8s/collector-configmap.yaml
401 views
1
apiVersion: v1
2
kind: ConfigMap
3
metadata:
4
name: otel-collector-config
5
data:
6
otel-collector-config.yaml: |-
7
receivers:
8
otlp:
9
protocols:
10
grpc:
11
endpoint: 0.0.0.0:4317
12
http:
13
endpoint: 0.0.0.0:4318
14
prometheus/collector: # needed if you use the docker-lgtm image
15
config:
16
scrape_configs:
17
- job_name: 'opentelemetry-collector'
18
static_configs:
19
- targets: [ 'localhost:8888' ]
20
filelog/json-ecs:
21
include:
22
- /var/log/pods/*/*/*.log
23
include_file_path: true
24
operators:
25
- id: container-parser
26
type: container
27
- id: router
28
type: router
29
routes:
30
- output: json_parser
31
expr: 'body matches "\\{[^{}]*\\}" == true'
32
- id: json_parser
33
type: json_parser
34
on_error: drop_quiet
35
body: attributes.message
36
timestamp:
37
parse_from: attributes["@timestamp"]
38
layout: '%Y-%m-%dT%H:%M:%S.%LZ'
39
severity:
40
parse_from: attributes["log.level"]
41
trace:
42
trace_id:
43
parse_from: attributes.trace_id
44
span_id:
45
parse_from: attributes.span_id
46
scope_name:
47
parse_from: attributes["log.logger"]
48
- id: move_service_namespace
49
type: move
50
if: 'attributes["service.namespace"] != nil'
51
from: attributes["service.namespace"]
52
to: resource["service.namespace"]
53
- id: move_service_name
54
type: move
55
from: attributes["service.name"]
56
to: resource["service.name"]
57
- id: move_service_instance_id
58
type: move
59
if: 'attributes["service.instance.id"] != nil'
60
from: attributes["service.instance.id"]
61
to: resource["service.instance.id"]
62
- id: move_deployment_environment
63
type: move
64
if: 'attributes["deployment.environment"] != nil'
65
from: attributes["deployment.environment"]
66
to: resource["deployment.environment"]
67
- id: move_thread_name
68
type: move
69
from: attributes["process.thread.name"]
70
to: attributes["thread.name"]
71
- id: move_error_message
72
type: move
73
if: 'attributes["error.message"] != nil'
74
from: attributes["error.message"]
75
to: attributes["exception.message"]
76
- id: move_error_type
77
type: move
78
if: 'attributes["error.type"] != nil'
79
from: attributes["error.type"]
80
to: attributes["exception.type"]
81
- id: move_throwable_stacktrace
82
type: move
83
if: 'len(attributes["error.stack_trace"]) > 0'
84
from: attributes["error.stack_trace"]
85
to: attributes["exception.stacktrace"]
86
- id: remove_logger_name
87
type: remove
88
field: attributes["log.logger"]
89
- id: remove_timestamp
90
type: remove
91
field: attributes["@timestamp"]
92
- id: remove_level
93
type: remove
94
field: attributes["log.level"]
95
- id: remove_span_id
96
if: 'attributes["span_id"] != nil'
97
type: remove
98
field: attributes.span_id
99
- id: remove_trace_id
100
if: 'attributes["trace_id"] != nil'
101
type: remove
102
field: attributes.trace_id
103
- id: remove_message
104
type: remove
105
field: attributes.message
106
- id: remove_ecs_version
107
type: remove
108
field: attributes["ecs.version"]
109
- id: remove_ecs_event_dataset
110
type: remove
111
field: attributes["event.dataset"]
112
- id: remove_trace_flags
113
type: remove
114
field: attributes["trace_flags"]
115
- id: remove_logtag
116
type: remove
117
field: attributes.logtag
118
- id: remove_file
119
type: remove
120
field: attributes["log.file.path"]
121
- id: remove_filename
122
type: remove
123
field: attributes["log.file.name"]
124
- id: remove_stream
125
type: remove
126
field: attributes["log.iostream"]
127
- id: remove_time
128
type: remove
129
field: attributes.time
130
131
processors:
132
batch:
133
resourcedetection:
134
detectors: [ "env", "system" ]
135
override: false
136
137
exporters:
138
otlphttp/metrics:
139
endpoint: http://localhost:9090/api/v1/otlp
140
otlphttp/traces:
141
endpoint: http://localhost:4418
142
otlphttp/logs:
143
endpoint: http://localhost:3100/otlp
144
debug/metrics:
145
verbosity: detailed
146
debug/traces:
147
verbosity: detailed
148
debug/logs:
149
verbosity: detailed
150
nop:
151
152
service:
153
pipelines:
154
traces:
155
receivers: [ otlp ]
156
processors: [ batch ]
157
exporters: [ otlphttp/traces ]
158
metrics:
159
receivers: [ otlp, prometheus/collector ]
160
processors: [ batch ]
161
exporters: [ otlphttp/metrics ]
162
logs/otlp:
163
receivers: [ otlp ]
164
processors: [ batch ]
165
exporters: [ otlphttp/logs ]
166
logs/json-ecs:
167
receivers: [ filelog/json-ecs ]
168
processors: [ batch ]
169
exporters: [ otlphttp/logs ]
170
# exporters: [ otlphttp/logs, debug/logs ] # Uncomment this line to enable debug logging
171
172
173
174