Skip to content

Commit 7870c97

Browse files
fix formatting
1 parent 4e910af commit 7870c97

File tree

1 file changed

+46
-48
lines changed
  • content/en/blog/2024/collecting-otel-compliant-java-logs-from-files

1 file changed

+46
-48
lines changed

content/en/blog/2024/collecting-otel-compliant-java-logs-from-files/index.md

+46-48
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ This blog post shows how to set up this solution step by step.
4646
ingest the logs.
4747
- Finally, we'll show a Kubernetes-specific setup to handle container logs.
4848

49-
5049
![OTLP/JSON Architecture](otlpjson-architecture.png)
5150

5251
## Configure Java application to output OTLP/JSON logs
@@ -118,91 +117,90 @@ OTLP/JSON format, with a JSON object per line. The log records are nested in the
118117

119118
```json
120119
{
121-
"resourceLogs":[
120+
"resourceLogs": [
122121
{
123-
"resource":{
124-
"attributes":[
122+
"resource": {
123+
"attributes": [
125124
{
126-
"key":"deployment.environment.name",
127-
"value":{
128-
"stringValue":"staging"
125+
"key": "deployment.environment.name",
126+
"value": {
127+
"stringValue": "staging"
129128
}
130129
},
131130
{
132-
"key":"service.instance.id",
133-
"value":{
134-
"stringValue":"6ad88e10-238c-4fb7-bf97-38df19053366"
131+
"key": "service.instance.id",
132+
"value": {
133+
"stringValue": "6ad88e10-238c-4fb7-bf97-38df19053366"
135134
}
136135
},
137136
{
138-
"key":"service.name",
139-
"value":{
140-
"stringValue":"checkout"
137+
"key": "service.name",
138+
"value": {
139+
"stringValue": "checkout"
141140
}
142141
},
143142
{
144-
"key":"service.namespace",
145-
"value":{
146-
"stringValue":"shop"
143+
"key": "service.namespace",
144+
"value": {
145+
"stringValue": "shop"
147146
}
148147
},
149148
{
150-
"key":"service.version",
151-
"value":{
152-
"stringValue":"1.1"
149+
"key": "service.version",
150+
"value": {
151+
"stringValue": "1.1"
153152
}
154153
}
155154
]
156155
},
157-
"scopeLogs":[
156+
"scopeLogs": [
158157
{
159-
"scope":{
160-
"name":"com.mycompany.checkout.CheckoutServiceServer$CheckoutServiceImpl",
161-
"attributes":[
162-
163-
]
158+
"scope": {
159+
"name": "com.mycompany.checkout.CheckoutServiceServer$CheckoutServiceImpl",
160+
"attributes": []
164161
},
165-
"logRecords":[
162+
"logRecords": [
166163
{
167-
"timeUnixNano":"1730435085776869000",
168-
"observedTimeUnixNano":"1730435085776944000",
169-
"severityNumber":9,
170-
"severityText":"INFO",
171-
"body":{
172-
"stringValue":"Order order-12035 successfully placed"
164+
"timeUnixNano": "1730435085776869000",
165+
"observedTimeUnixNano": "1730435085776944000",
166+
"severityNumber": 9,
167+
"severityText": "INFO",
168+
"body": {
169+
"stringValue": "Order order-12035 successfully placed"
173170
},
174-
"attributes":[
171+
"attributes": [
175172
{
176-
"key":"customerId",
177-
"value":{
178-
"stringValue":"customer-49"
173+
"key": "customerId",
174+
"value": {
175+
"stringValue": "customer-49"
179176
}
180177
},
181178
{
182-
"key":"thread.id",
183-
"value":{
184-
"intValue":"44"
179+
"key": "thread.id",
180+
"value": {
181+
"intValue": "44"
185182
}
186183
},
187184
{
188-
"key":"thread.name",
189-
"value":{
190-
"stringValue":"grpc-default-executor-1"
185+
"key": "thread.name",
186+
"value": {
187+
"stringValue": "grpc-default-executor-1"
191188
}
192189
}
193190
],
194-
"flags":1,
195-
"traceId":"42de1f0dd124e27619a9f3c10bccac1c",
196-
"spanId":"270984d03e94bb8b"
191+
"flags": 1,
192+
"traceId": "42de1f0dd124e27619a9f3c10bccac1c",
193+
"spanId": "270984d03e94bb8b"
197194
}
198195
]
199196
}
200197
],
201-
"schemaUrl":"https://opentelemetry.io/schemas/1.24.0"
198+
"schemaUrl": "https://opentelemetry.io/schemas/1.24.0"
202199
}
203200
]
204201
}
205202
```
203+
206204
</details>
207205

208206
## Configure the Collector to ingest the OTLP/JSON logs
@@ -313,8 +311,8 @@ After the pipeline works end-to-end, ensure production readiness:
313311

314312
## Configure an OpenTelemetry Collector in Kubernetes to handle container logs
315313

316-
To support Kubernetes and container specifics, add the built-in
317-
[`container`](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/pkg/stanza/docs/operators/container.md)
314+
To support Kubernetes and container specifics, add the built-in
315+
[`container`](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/pkg/stanza/docs/operators/container.md)
318316
parsing step in the pipeline without needing specific mapping configuration.
319317

320318
Replace `<<namespace>>`, `<<pod_name>>`, and `<<container_name>>` with the

0 commit comments

Comments
 (0)