[logstash] Enable TSDB for metrics data streams#17401
Draft
AndersonQ wants to merge 1 commit intoelastic:mainfrom
Draft
[logstash] Enable TSDB for metrics data streams#17401AndersonQ wants to merge 1 commit intoelastic:mainfrom
AndersonQ wants to merge 1 commit intoelastic:mainfrom
Conversation
Enable TSDB for health_report and node_cel data streams in the Logstash integration and add metric_type annotations to pipeline and plugins. Dimensions added: - health_report: logstash.node.name, logstash.node.uuid, logstash.pipeline.id - node_cel: logstash.node.stats.logstash.name - pipeline: logstash.pipeline.host.name - plugins: logstash.pipeline.host.name Annotate numeric fields with appropriate metric_type for the health_report, node_cel, pipeline, plugins data streams. metric_type corrections (counter → gauge): - node_cel: jvm.threads.count, jvm.threads.peak_count, jvm.mem.heap_max_in_bytes, queue.events_count - pipeline: logstash.pipeline.queues.events - plugins: beats.peak_connections, beats.current_connections Assisted by Cursor
1b1af21 to
6cbf6df
Compare
💔 Build Failed
Failed CI StepsHistorycc @AndersonQ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed commit message
Data stream changes summary
Data Stream:
health_reportDimensions Added
logstash.node.namelogstash.node.uuidlogstash.pipeline.idFields with metric_type Added
logstash.pipeline.impacts.severitylogstash.pipeline.flow.worker_utilization.currentlogstash.pipeline.flow.worker_utilization.last_1_hourlogstash.pipeline.flow.worker_utilization.last_5_minuteslogstash.pipeline.flow.worker_utilization.last_15_minuteslogstash.pipeline.flow.worker_utilization.lifetimelogstash.pipeline.flow.worker_utilization.last_1_minutelogstash.pipeline.flow.worker_utilization.last_24_hoursData Stream:
node_celDimensions Added
logstash.node.stats.logstash.nameFields with metric_type Added
logstash.node.stats.pipelines.reloads.failureslogstash.node.stats.pipelines.reloads.successeslogstash.node.stats.pipelines.queue.events_countlogstash.node.stats.pipelines.queue.queue_size_in_byteslogstash.node.stats.pipelines.queue.max_queue_size_in_byteslogstash.node.stats.pipelines.events.inlogstash.node.stats.pipelines.events.outlogstash.node.stats.pipelines.events.filteredlogstash.node.stats.pipelines.events.duration_in_millislogstash.node.stats.pipelines.events.queue_push_duration_in_millisFields with metric_type Changed
logstash.node.stats.jvm.threads.countlogstash.node.stats.jvm.threads.peak_countlogstash.node.stats.jvm.mem.heap_max_in_byteslogstash.node.stats.queue.events_countData Stream:
pipelineDimensions Added
logstash.pipeline.host.nameFields with metric_type Added
logstash.pipeline.info.batch_sizelogstash.pipeline.info.batch_delaylogstash.pipeline.info.workersFields with metric_type Changed
logstash.pipeline.queues.eventsData Stream:
pluginsDimensions Added
logstash.pipeline.host.nameFields with metric_type Changed
logstash.pipeline.plugin.input.metrics.beats.peak_connectionslogstash.pipeline.plugin.input.metrics.beats.current_connectionsOpen questions
As the data streams are migrated to TSDB they do not support metrics which documents
containing the error when fetching a metric as those would not have the necessary
dimensions. When testing, I started the agent before logstash was ready, getting
a few errors, which when testing the migration with https://github.com/elastic/TSDB-migration-test-kit
could not be migrated.
If we want to keep this behaviour, I don't think the data stream can be migrated
to TSDB.
On my tests, the error events were present on
health_reportand onnode_celdata streams.
Here is an example of the error documents:
{"error": {"type": "illegal_argument_exception", "reason": "Error extracting routing: source didn't contain any routing fields"}, "status": 400, "document": {"cloud": {"availability_zone": "us-central1-f", "instance": {"name": "anderson-logstash", "id": "8077647130981829769"}, "provider": "gcp", "service": {"name": "GCE"}, "machine": {"type": "e2-standard-4"}, "project": {"id": "elastic-observability"}, "region": "us-central1", "account": {"id": "elastic-observability"}}, "input": {"type": "cel"}, "agent": {"name": "anderson-logstash", "id": "27ad10fc-cef3-424a-879c-23721c867517", "type": "filebeat", "ephemeral_id": "c2cfc104-c50f-4906-af6e-7ddcf911012a", "version": "8.17.10"}, "@timestamp": "2026-02-12T11:32:41.562Z", "ecs": {"version": "8.0.0"}, "data_stream": {"namespace": "default", "type": "metrics", "dataset": "logstash.node"}, "elastic_agent": {"id": "27ad10fc-cef3-424a-879c-23721c867517", "version": "8.17.10", "snapshot": false}, "host": {"hostname": "anderson-logstash", "os": {"kernel": "6.1.0-43-cloud-amd64", "codename": "bookworm", "name": "Debian GNU/Linux", "type": "linux", "family": "debian", "version": "12 (bookworm)", "platform": "debian"}, "containerized": false, "ip": ["10.128.0.72", "fe80::4001:aff:fe80:48"], "name": "anderson-logstash", "id": "370ef8b742434f90a470fd961035344e", "mac": ["42-01-0A-80-00-48"], "architecture": "x86_64"}, "error": {"message": "failed eval: ERROR: <input>:7:7: Get \"http://localhost:9600/_node/stats?graph=true&vertices=true\": dial tcp [::1]:9600: connect: connection refused\n | ? {\n | ......^"}, "event": {"agent_id_status": "verified", "ingested": "2026-02-12T11:32:50Z", "dataset": "logstash.node"}}}One option could be to have the
agent.idas dimension, that way the error eventscould be indexed, having their TSDB ID from the
agent.id+timestamp, what seemsok. However, it means additional mappings and dimensions for this corner case.
I checked and the errors are still logged and appear on the agent dashboards
which show errors, like the "concerning agents". So, the errors aren't lost,
nevertheless, it's still a breaking change if anyone would rely on documents with
the
errorkey to know something is wrong.Checklist
[ ] I have reviewed tips for building integrations and this pull request is aligned with them.[ ] I have added an entry to my package'schangelog.ymlfile.[ ] I have verified that Kibana version constraints are current according to guidelines.[ ] I have verified that any added dashboard complies with Kibana's Dashboard good practicesHow to test this PR locally
I used a modified version
of the TSDB migration test kit
to test the migration of the data streams to TSDB. It reindex the source index
to the destination index. This approach fails if there are documents that cannot
be ingested into the TSDB. For example the "error" events I mentioned above.
Thus, I modified it to scan the source index and use the bulk API to index the
documents, saving the failed and duplicated documents into 2 different files.
You may try both versions of the test kit.
click to show instructions
Agent + Logstash output setup
Let's setup 2 nodes. All paths are relative to the Logstash directory
logstash: node 1:
agent.conf:
config/logstash.yml:
cd logstasn-node-1 ./bin/logstash -f agent.conflogstash: node 2:
agent.conf:
config/logstash.yml:
cd logstasn-node-2 ./bin/logstash -f agent.confElastic Agent
["localhost:5044", "localhost:5045"]flog -t log -o /tmp/agent/in/log.ndjson -w -f json -l -p 1048576 -d 500ms--namespace logstash-outputElastic Agent with Logstash integration
http://localhost:9600/tmp/logstash-node-1/logs/logstash-plain*.log/tmp/logstash-node-1/logs/logstash-slowlog-plain*.loghttp://localhost:9600http://localhost:9601/tmp/logstash-node-2/logs/logstash-plain*.log/tmp/logstash-node-2/logs/logstash-slowlog-plain*.loghttp://localhost:9601--namespace monitoringVerify
path
/tmp/agent/in/log.ndjsonI recomend to let it run for a good while, so there will be a good amount of data
https://github.com/elastic/TSDB-migration-test-kit can use when testing the TSDB
migration.
elastic-package build -v && elastic-package install -vRelated issues