logstash-output-otlp 0.4.7-java → 0.4.8-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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 99edd5380c8a604ff1635507ffe85f213a05092e4b9508f7273df289da3abe31
4
- data.tar.gz: 7ed7840fb269a6108d3679c77250c9e68b3953661a48903c4bb1d7e30ef025fa
3
+ metadata.gz: 0f90cd96a0e71fb8ba83b205a0fa87a07f6e2e6884b96c1c9939e0d0d910427d
4
+ data.tar.gz: 3ca39774b5d9722ce5a4ccb9f3eb6219fe9a421cd8aa87581bb2bc427fe543f0
5
5
  SHA512:
6
- metadata.gz: b45a36f07a5c1818247675b4a3806fc52d5f911e79cf2563858ad38a0c4576b7662de4ec816c66a7b8084eee97c6b1eda1814addea4e486f30c900116e2ff148
7
- data.tar.gz: 5bd376d2998654a9c6ee5f39f79fa421b95880111600c84c77948076ba3596f4e22214d86aea040b8d47ce84707bd79c4ae6fb7fb2606e692991b5f0b9753882
6
+ metadata.gz: 7528f3db38538b64cf72870c17a03be1b38e37aa7f515ead93a84a6661390688971de703aef450aea956ab7ac88ef9c87b48ffd6a99287f75ef184391b720568
7
+ data.tar.gz: 54686e7bb1be213e566f0abe8a90a071e23649a27c3696345fd4c3c7014338ec3c53f08777c99637fe06b35427efb3843feea101639197d112aac6882d07be8e
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,7 +252,7 @@ For unit tests, build the Logstash core jar first:
224
252
 
225
253
  ```bash
226
254
  make logstashcorejar
227
- JAVA_HOME=/opt/homebrew/Cellar/openjdk@17/17.0.18/libexec/openjdk.jdk/Contents/Home ./gradlew test -PLOGSTASH_CORE_PATH=/Users/willianmarchan/Projects/BCP/O11Y/logstash-output-otlp/assets/logstash-9.0.0/logstash-core
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.
@@ -246,6 +274,33 @@ RUN logstash-plugin install logstash-output-otlp
246
274
  The certificates under `config/tls` are local test certificates used by the Docker Compose example.
247
275
  Do not reuse those private keys or certificates in shared, staging, or production environments.
248
276
 
277
+ ### Check export error logging manually
278
+
279
+ The small Compose example uses one Logstash output and an OTLP/HTTP Collector,
280
+ without authentication. With Java 17 and Docker Compose available, build the gem
281
+ and send five events:
282
+
283
+ ```sh
284
+ make gem
285
+ docker compose -f tests/integration/compose.yml build
286
+ docker compose -f tests/integration/compose.yml up -d collector
287
+ docker compose -f tests/integration/compose.yml run --rm logstash
288
+ docker compose -f tests/integration/compose.yml logs collector
289
+ ```
290
+
291
+ The Collector should print `OTLP manual export test` for the received events.
292
+ To simulate an unavailable destination, stop it and send again:
293
+
294
+ ```sh
295
+ docker compose -f tests/integration/compose.yml stop collector
296
+ docker compose -f tests/integration/compose.yml run --rm --no-deps logstash
297
+ docker compose -f tests/integration/compose.yml down
298
+ ```
299
+
300
+ Logstash should print `OTLP export failed: output_id=manual_otlp
301
+ endpoint=http://collector:4318/v1/logs records=5`. Repeated failures are logged
302
+ at most once every 30 seconds per output. This diagnostic does not resend events.
303
+
249
304
  ## Notes
250
305
 
251
306
  **Warning** This plugin depends on OpenTelemetry logging libraries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.7
1
+ 0.4.8
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
+ ![Classic centralized logging architecture](./images/classic-elastic-logging-architecture.png)
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
+ ![Logs, traces, and metrics share one identity](./images/otel-three-signals.png)
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
+ ![Signal routing through the OpenTelemetry Collector](./images/otel-collector-routing.png)
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
+ ![Gradual migration roadmap](./images/otel-migration-roadmap.png)
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
@@ -2,4 +2,4 @@
2
2
  # encoding: utf-8
3
3
 
4
4
  require 'jar_dependencies'
5
- require_jar('org.otlp', 'logstash-output-otlp', '0.4.7')
5
+ require_jar('org.otlp', 'logstash-output-otlp', '0.4.8')
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.7
4
+ version: 0.4.8
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-07-27 00:00:00.000000000 Z
11
+ date: 2026-09-23 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.4.7/logstash-output-otlp-0.4.7.jar
83
+ - vendor/jar-dependencies/org/otlp/logstash-output-otlp/0.4.8/logstash-output-otlp-0.4.8.jar
78
84
  homepage: https://github.com/wjma90/logstash-output-otlp
79
85
  licenses:
80
86
  - Apache-2.0