logstash-output-otlp 0.4.7-java → 0.5.0-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +59 -6
- data/VERSION +1 -1
- data/docs/blog.md +179 -0
- data/docs/images/classic-elastic-logging-architecture.png +0 -0
- data/docs/images/logstash-otlp-architecture.png +0 -0
- data/docs/images/otel-collector-routing.png +0 -0
- data/docs/images/otel-migration-roadmap.png +0 -0
- data/docs/images/otel-three-signals.png +0 -0
- data/lib/logstash-output-otlp_jars.rb +1 -1
- data/vendor/jar-dependencies/org/otlp/logstash-output-otlp/{0.4.7/logstash-output-otlp-0.4.7.jar → 0.5.0/logstash-output-otlp-0.5.0.jar} +0 -0
- metadata +9 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9b52eb6dd3c022d4044a25d15b65b0b4f0c49fed621dbad3719fbd1bc1c64550
|
|
4
|
+
data.tar.gz: a553cb6bb1fe87ce81d44d56b11c32f324041a351daad834ad0a6b2aa979bf50
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e817e73a885e5c451468b073ed4baab8a700b8ba907f13dbbaead07da6ffce65e15058b4006d8062b8a2301511887bc07f0cca436d55466c0a5c09e30a0b4d18
|
|
7
|
+
data.tar.gz: 00b32d6a761e488dd1622fc081b93b768427af912871d983ed2e180ca25ebcfb0cdaef7dcf3e2c89bbc9b835c139edc82f79b4ce927809ea8493d40082c7e52f
|
data/README.md
CHANGED
|
@@ -104,6 +104,10 @@ output {
|
|
|
104
104
|
| compression | [string](https://www.elastic.co/guide/en/logstash/8.12/configuration-file-structure.html#string), one of ["gzip", "none"] | No |
|
|
105
105
|
| connect_timeout | [long](https://www.elastic.co/guide/en/logstash/8.12/configuration-file-structure.html#number) | No |
|
|
106
106
|
| timeout | [long](https://www.elastic.co/guide/en/logstash/8.12/configuration-file-structure.html#number) | No |
|
|
107
|
+
| max_queue_size | long | No |
|
|
108
|
+
| max_batch_size | long | No |
|
|
109
|
+
| schedule_delay_millis | long | No |
|
|
110
|
+
| export_timeout_millis | long | No |
|
|
107
111
|
| ssl_disable_tls_verification | [boolean](https://www.elastic.co/guide/en/logstash/8.12/configuration-file-structure.html#string) | No |
|
|
108
112
|
| ssl_certificate_authorities | [string](https://www.elastic.co/guide/en/logstash/8.12/configuration-file-structure.html#string) | No |
|
|
109
113
|
| resource | [Hash](https://www.elastic.co/guide/en/logstash/latest/configuration-file-structure.html#hash) | No |
|
|
@@ -136,6 +140,30 @@ An endpoint that supports otlp to which logs are sent.
|
|
|
136
140
|
|
|
137
141
|
- Value type is [long](https://www.elastic.co/guide/en/logstash/8.12/configuration-file-structure.html#number)
|
|
138
142
|
- Default is: `10` (seconds)
|
|
143
|
+
- Must be positive and no greater than `export_timeout_millis / 1000`.
|
|
144
|
+
|
|
145
|
+
Batch settings:
|
|
146
|
+
|
|
147
|
+
| Setting | Default | Purpose |
|
|
148
|
+
| --- | --- | --- |
|
|
149
|
+
| `max_queue_size` | `2048` | Maximum records waiting in memory. |
|
|
150
|
+
| `max_batch_size` | `512` | Maximum records in one export. |
|
|
151
|
+
| `schedule_delay_millis` | `1000` | Interval for exporting an incomplete batch; a full batch can send earlier. |
|
|
152
|
+
| `export_timeout_millis` | `30000` | Maximum wait for an export result in the batch processor. |
|
|
153
|
+
|
|
154
|
+
All four values must be positive integers, and `max_batch_size` must not exceed
|
|
155
|
+
`max_queue_size`. Invalid or overflowing values fail at startup.
|
|
156
|
+
|
|
157
|
+
The OTLP SDK retries transient failures with exponential backoff and jitter,
|
|
158
|
+
up to five attempts including the original request. The initial delay is about
|
|
159
|
+
one second, multiplied by 1.5, with a nominal five-second backoff cap. The request
|
|
160
|
+
`timeout` can end retries earlier; five attempts are not guaranteed. See the
|
|
161
|
+
[SDK retry policy](https://github.com/open-telemetry/opentelemetry-java/blob/v1.62.0/sdk/common/src/main/java/io/opentelemetry/sdk/common/export/RetryPolicy.java).
|
|
162
|
+
|
|
163
|
+
Keep `export_timeout_millis` above the request timeout with some margin; the
|
|
164
|
+
processor's wait does not cancel the network request. The queue is bounded and
|
|
165
|
+
in memory: excess events are dropped when it fills, and batches that exhaust
|
|
166
|
+
their retries are not requeued. This does not guarantee delivery during an outage.
|
|
139
167
|
|
|
140
168
|
`protocol`
|
|
141
169
|
|
|
@@ -224,17 +252,40 @@ For unit tests, build the Logstash core jar first:
|
|
|
224
252
|
|
|
225
253
|
```bash
|
|
226
254
|
make logstashcorejar
|
|
227
|
-
|
|
255
|
+
./gradlew test -PLOGSTASH_CORE_PATH="$PWD/assets/logstash-9.0.0/logstash-core"
|
|
228
256
|
```
|
|
229
257
|
|
|
230
258
|
`make gem` also builds the Logstash core jar before packaging the local plugin gem.
|
|
231
259
|
|
|
260
|
+
## Monitoring
|
|
261
|
+
|
|
262
|
+
The output exposes the Java SDK's `LATEST` log processor and exporter metrics
|
|
263
|
+
under `sdk_metrics` in Logstash's Node Stats API, preserving component,
|
|
264
|
+
endpoint and error attributes. The [metrics demo](tests/integration/queue/README.md)
|
|
265
|
+
shows successful exports, failures and queue saturation in Prometheus.
|
|
266
|
+
`kuskoman/logstash-exporter` v1.9.2 needs additional collector support for these
|
|
267
|
+
custom fields; the demo uses JSON Exporter mappings.
|
|
268
|
+
|
|
232
269
|
## Running locally
|
|
233
270
|
|
|
234
|
-
|
|
271
|
+
With Java 17 and Docker running:
|
|
235
272
|
|
|
236
|
-
|
|
237
|
-
|
|
273
|
+
```sh
|
|
274
|
+
make gem
|
|
275
|
+
docker compose up --build
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
Logstash sends ten records over OTLP/HTTP. The Collector (`otel`) prints them
|
|
279
|
+
using its `debug` exporter with the body `OTLP local example`.
|
|
280
|
+
|
|
281
|
+
From another terminal:
|
|
282
|
+
|
|
283
|
+
```sh
|
|
284
|
+
docker compose logs otel
|
|
285
|
+
docker compose down
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
The Dockerfile installs the local gem built from this repository.
|
|
238
289
|
|
|
239
290
|
For a production-like image that installs the published gem from RubyGems, use:
|
|
240
291
|
|
|
@@ -243,8 +294,10 @@ FROM docker.elastic.co/logstash/logstash:9.4.4@sha256:c1aeca2bbf56148c1c868957e1
|
|
|
243
294
|
RUN logstash-plugin install logstash-output-otlp
|
|
244
295
|
```
|
|
245
296
|
|
|
246
|
-
|
|
247
|
-
|
|
297
|
+
### Integration tests
|
|
298
|
+
|
|
299
|
+
See [tests/integration](tests/integration/README.md) for manual tests of export
|
|
300
|
+
error logging, queue metrics in Prometheus and the timestamp fix for Loki.
|
|
248
301
|
|
|
249
302
|
## Notes
|
|
250
303
|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.5.0
|
data/docs/blog.md
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# De Logback y Elastic a OpenTelemetry: Logstash como puente OTLP
|
|
2
|
+
|
|
3
|
+
## Cómo conectar logs, trazas y métricas sin reescribir las aplicaciones Java
|
|
4
|
+
|
|
5
|
+
Muchas plataformas Java centralizan sus logs con una arquitectura conocida:
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
Logback escribe en `stdout` o en un archivo. Filebeat o Elastic Agent recolecta el evento, Logstash lo transforma, Elasticsearch lo indexa y Kibana permite buscarlo.
|
|
10
|
+
|
|
11
|
+
El modelo funciona, pero aparece una separación cuando se incorpora el OpenTelemetry Java Agent:
|
|
12
|
+
|
|
13
|
+
- trazas y métricas salen por OTLP;
|
|
14
|
+
- los logs siguen viajando por Logback y Logstash;
|
|
15
|
+
- el contexto de una misma petición termina repartido entre plataformas.
|
|
16
|
+
|
|
17
|
+
`logstash-output-otlp` cierra esa brecha: toma el evento procesado por Logstash, lo convierte en un `LogRecord` OTLP y lo envía a un OpenTelemetry Collector.
|
|
18
|
+
|
|
19
|
+
## Una identidad compartida
|
|
20
|
+
|
|
21
|
+

|
|
22
|
+
|
|
23
|
+
El plugin exporta **logs**. El Java Agent continúa exportando **trazas y métricas**. La correlación funciona porque las tres señales comparten:
|
|
24
|
+
|
|
25
|
+
- `service.name`;
|
|
26
|
+
- `trace.id`;
|
|
27
|
+
- `span.id`;
|
|
28
|
+
- ambiente, versión e identidad de Kubernetes.
|
|
29
|
+
|
|
30
|
+
El Java Agent puede inyectar `trace.id` y `span.id` en el MDC de Logback. El formato del log debe conservarlos:
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"@timestamp": "2026-07-27T14:50:15.922Z",
|
|
35
|
+
"log.level": "WARN",
|
|
36
|
+
"message": "El pago excedió el tiempo esperado",
|
|
37
|
+
"service.name": "payments-api",
|
|
38
|
+
"trace.id": "5b8aa5a2d2c872e8321cf37308d69df2",
|
|
39
|
+
"span.id": "051581bf3cb55c13"
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Si Filebeat o los filtros de Logstash eliminan estos campos, la correlación se pierde.
|
|
44
|
+
|
|
45
|
+
## Instalar y configurar el plugin
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
bin/logstash-plugin install logstash-output-otlp
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Durante la transición, Logstash puede conservar Elasticsearch y añadir OTLP como segunda salida:
|
|
52
|
+
|
|
53
|
+
```ruby
|
|
54
|
+
input {
|
|
55
|
+
beats {
|
|
56
|
+
port => 5044
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
output {
|
|
61
|
+
elasticsearch {
|
|
62
|
+
hosts => ["https://elasticsearch:9200"]
|
|
63
|
+
index => "application-logs-%{+YYYY.MM.dd}"
|
|
64
|
+
user => "${ELASTIC_USER}"
|
|
65
|
+
password => "${ELASTIC_PASSWORD}"
|
|
66
|
+
ssl_enabled => true
|
|
67
|
+
ssl_certificate_authorities => ["/etc/logstash/certs/elastic-ca.crt"]
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
otlp {
|
|
71
|
+
endpoint => "https://otel-collector:4317"
|
|
72
|
+
protocol => "grpc"
|
|
73
|
+
compression => "gzip"
|
|
74
|
+
ssl_certificate_authorities => "/etc/logstash/certs/otel-ca.crt"
|
|
75
|
+
|
|
76
|
+
body => "message"
|
|
77
|
+
severity_text => "[log][level]"
|
|
78
|
+
trace_id => "trace.id"
|
|
79
|
+
span_id => "span.id"
|
|
80
|
+
|
|
81
|
+
resource => {
|
|
82
|
+
"service.name" => "payments-api"
|
|
83
|
+
"deployment.environment.name" => "production"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Antes de activar OTLP conviene inspeccionar un evento real con `stdout { codec => rubydebug }` y confirmar los nombres de los campos.
|
|
90
|
+
|
|
91
|
+
## El Collector como frontera neutral
|
|
92
|
+
|
|
93
|
+

|
|
94
|
+
|
|
95
|
+
El Collector desacopla productores y destinos:
|
|
96
|
+
|
|
97
|
+
- logs de Logstash → Loki;
|
|
98
|
+
- trazas del Java Agent → Tempo;
|
|
99
|
+
- métricas del Java Agent → Prometheus.
|
|
100
|
+
|
|
101
|
+
Una configuración mínima puede separar las señales así:
|
|
102
|
+
|
|
103
|
+
```yaml
|
|
104
|
+
receivers:
|
|
105
|
+
otlp:
|
|
106
|
+
protocols:
|
|
107
|
+
grpc:
|
|
108
|
+
endpoint: 0.0.0.0:4317
|
|
109
|
+
|
|
110
|
+
processors:
|
|
111
|
+
memory_limiter:
|
|
112
|
+
check_interval: 1s
|
|
113
|
+
limit_mib: 512
|
|
114
|
+
batch: {}
|
|
115
|
+
|
|
116
|
+
exporters:
|
|
117
|
+
otlphttp/loki:
|
|
118
|
+
endpoint: http://loki:3100/otlp
|
|
119
|
+
otlp/tempo:
|
|
120
|
+
endpoint: tempo:4317
|
|
121
|
+
tls:
|
|
122
|
+
insecure: true
|
|
123
|
+
prometheusremotewrite:
|
|
124
|
+
endpoint: http://prometheus:9090/api/v1/write
|
|
125
|
+
|
|
126
|
+
service:
|
|
127
|
+
pipelines:
|
|
128
|
+
logs:
|
|
129
|
+
receivers: [otlp]
|
|
130
|
+
processors: [memory_limiter, batch]
|
|
131
|
+
exporters: [otlphttp/loki]
|
|
132
|
+
traces:
|
|
133
|
+
receivers: [otlp]
|
|
134
|
+
processors: [memory_limiter, batch]
|
|
135
|
+
exporters: [otlp/tempo]
|
|
136
|
+
metrics:
|
|
137
|
+
receivers: [otlp]
|
|
138
|
+
processors: [memory_limiter, batch]
|
|
139
|
+
exporters: [prometheusremotewrite]
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Los endpoints, TLS y mecanismos de autenticación deben adaptarse al entorno.
|
|
143
|
+
|
|
144
|
+
## De un log a una traza
|
|
145
|
+
|
|
146
|
+
Con el contexto preservado, el recorrido en Grafana es directo:
|
|
147
|
+
|
|
148
|
+
```text
|
|
149
|
+
alerta en Prometheus
|
|
150
|
+
→ servicio afectado
|
|
151
|
+
→ log en Loki
|
|
152
|
+
→ trace.id
|
|
153
|
+
→ traza completa en Tempo
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
`trace.id` no debería convertirse en una etiqueta indexada de Loki: su cardinalidad es muy alta. Es mejor conservarlo como metadata estructurada o campo consultable.
|
|
157
|
+
|
|
158
|
+
## Migrar sin un “big bang”
|
|
159
|
+
|
|
160
|
+

|
|
161
|
+
|
|
162
|
+
1. **Conservar:** mantener Elastic mientras se valida el flujo actual.
|
|
163
|
+
2. **Correlacionar:** inyectar `trace.id` y `span.id` en el MDC.
|
|
164
|
+
3. **Duplicar:** añadir la salida OTLP junto a Elasticsearch.
|
|
165
|
+
4. **Conectar:** consultar logs, trazas y métricas desde Grafana.
|
|
166
|
+
|
|
167
|
+
Durante la convivencia se debe comparar volumen, timestamps, severidad, atributos y comportamiento ante fallos.
|
|
168
|
+
|
|
169
|
+
## Consideraciones de producción
|
|
170
|
+
|
|
171
|
+
- Usar TLS y verificar la CA del Collector.
|
|
172
|
+
- No habilitar `ssl_disable_tls_verification`.
|
|
173
|
+
- Definir una lista explícita de atributos para evitar datos sensibles.
|
|
174
|
+
- Aplicar redacción y filtros también en el Collector.
|
|
175
|
+
- Habilitar persistent queues si se requiere tolerar interrupciones.
|
|
176
|
+
- Supervisar reintentos, descartes y presión de memoria.
|
|
177
|
+
- Fijar versiones y digests de las imágenes.
|
|
178
|
+
|
|
179
|
+
La meta no es reemplazar Elastic de inmediato. Es aprovechar el pipeline existente y convertir Logstash en una vía de adopción gradual hacia OTLP, Loki, Tempo, Prometheus u otros backends compatibles.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: logstash-output-otlp
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: java
|
|
6
6
|
authors:
|
|
7
7
|
- Willian Marchan
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-11-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -70,11 +70,17 @@ files:
|
|
|
70
70
|
- LICENSE
|
|
71
71
|
- README.md
|
|
72
72
|
- VERSION
|
|
73
|
+
- docs/blog.md
|
|
74
|
+
- docs/images/classic-elastic-logging-architecture.png
|
|
75
|
+
- docs/images/logstash-otlp-architecture.png
|
|
76
|
+
- docs/images/otel-collector-routing.png
|
|
77
|
+
- docs/images/otel-migration-roadmap.png
|
|
78
|
+
- docs/images/otel-three-signals.png
|
|
73
79
|
- docs/index.asciidoc
|
|
74
80
|
- lib/logstash-output-otlp_jars.rb
|
|
75
81
|
- lib/logstash/outputs/otlp.rb
|
|
76
82
|
- logstash-output-otlp.gemspec
|
|
77
|
-
- vendor/jar-dependencies/org/otlp/logstash-output-otlp/0.
|
|
83
|
+
- vendor/jar-dependencies/org/otlp/logstash-output-otlp/0.5.0/logstash-output-otlp-0.5.0.jar
|
|
78
84
|
homepage: https://github.com/wjma90/logstash-output-otlp
|
|
79
85
|
licenses:
|
|
80
86
|
- Apache-2.0
|