Skip to content

eBPF-based security platform

Documentation: add collector integrations to Operate

Daniel Borkmannae1143890e74
diff --git a/Documentation/operate/index.rst b/Documentation/operate/index.rst
index d9c60939..05ce86ef 100644
--- a/Documentation/operate/index.rst
+++ b/Documentation/operate/index.rst
@@ -24,6 +24,8 @@ refusal or verdict is an incident: follow
initialized target
- :doc:`run/index`: deliver packages, read status, export telemetry and
attest targets
+- :doc:`integrations/index`: send telemetry to ClickHouse, Splunk and
+ Grafana
- :doc:`maintain/index`: signing keys, upgrades, backup, recovery and
decommissioning
- :doc:`troubleshoot/index`: failures by symptom, tampered targets and bug
@@ -35,5 +37,6 @@ refusal or verdict is an incident: follow
plan/index
deploy/index
run/index
+ integrations/index
maintain/index
troubleshoot/index
diff --git a/Documentation/operate/integrations/clickhouse.rst b/Documentation/operate/integrations/clickhouse.rst
new file mode 100644
index 00000000..b8b16235
--- /dev/null
+++ b/Documentation/operate/integrations/clickhouse.rst
@@ -0,0 +1,133 @@
+..
+ SPDX-License-Identifier: BSD-2-Clause
+ Copyright (c) 2026 Authors of shirudo
+
+:page-type: How-to
+:audience: Operators, SecOps
+
+Export to ClickHouse
+====================
+
+Store the keepalives and map snapshots of your targets in ClickHouse,
+through the OpenTelemetry Collector's ClickHouse exporter. The exporter
+writes OTLP logs to one table and each kind of metric to a table of its
+own.
+
+Before you begin
+----------------
+
+- Targets that export to a collector, as
+ :doc:`/operate/run/telemetry` describes, with the collector's ``otlp``
+ receiver set up there.
+- The OpenTelemetry Collector Contrib distribution, ``otelcol-contrib``,
+ built with Go 1.24 or later. The contrib distribution includes the
+ ClickHouse exporter; Go 1.24 offers the hybrid key exchange the
+ targets require.
+- A ClickHouse server the collector can reach, and a user for the
+ collector that may create tables in its database and insert into
+ them.
+
+The exporter's log support is beta and its metric support alpha.
+
+Set up the exporter
+-------------------
+
+#. Create the database and the collector's user:
+
+ .. code-block:: sql
+
+ CREATE DATABASE shirudo;
+ CREATE USER otel IDENTIFIED BY '<password>';
+ GRANT CREATE TABLE, INSERT, SELECT ON shirudo.* TO otel;
+
+#. Add the exporter and the pipelines to the collector's configuration,
+ next to the ``otlp`` receiver:
+
+ .. code-block:: yaml
+
+ exporters:
+ clickhouse:
+ endpoint: tcp://<clickhouse-host>:9440?secure=true
+ database: shirudo
+ username: otel
+ password: ${env:CLICKHOUSE_PASSWORD}
+ create_schema: true
+ ttl: 720h
+ sending_queue:
+ batch:
+ flush_timeout: 5s
+ min_size: 5000
+
+ service:
+ pipelines:
+ logs:
+ receivers: [otlp]
+ exporters: [clickhouse]
+ metrics:
+ receivers: [otlp]
+ exporters: [clickhouse]
+
+ ``create_schema`` lets the exporter create its tables, ``otel_logs``
+ for logs and ``otel_metrics_gauge``, ``otel_metrics_sum`` and their
+ siblings for metrics. Set it to ``false`` to create them yourself.
+ ``ttl`` drops rows older than 30 days. ``CLICKHOUSE_PASSWORD`` comes
+ from the collector's environment.
+
+#. Restart the collector.
+
+Check the data
+--------------
+
+#. List the latest keepalives:
+
+ .. code-block:: sql
+
+ SELECT Timestamp,
+ ResourceAttributes['host.name'] AS host,
+ LogAttributes['shirudo.status'] AS status
+ FROM shirudo.otel_logs
+ WHERE ServiceName = 'shirudo' AND EventName = 'shirudo.keepalive'
+ ORDER BY Timestamp DESC
+ LIMIT 10;
+
+ A target sends a keepalive every few seconds, so each target shows up
+ within a minute of the restart.
+
+#. Show the last verdict of every target and when it last reported:
+
+ .. code-block:: sql
+
+ SELECT ResourceAttributes['host.name'] AS host,
+ argMax(LogAttributes['shirudo.status'], Timestamp) AS status,
+ max(Timestamp) AS last_seen
+ FROM shirudo.otel_logs
+ WHERE ServiceName = 'shirudo' AND EventName = 'shirudo.keepalive'
+ GROUP BY host
+ ORDER BY last_seen;
+
+ A target at the top whose ``last_seen`` falls behind has stopped
+ sending, and a ``status`` other than ``ok`` needs a look, as
+ :doc:`/operate/run/telemetry` describes under what to alert on.
+
+#. Read the map snapshots of one upatch:
+
+ .. code-block:: sql
+
+ SELECT Timestamp, LogAttributes['shirudo.map.name'] AS map, Body
+ FROM shirudo.otel_logs
+ WHERE EventName = 'shirudo.bpf.map.snapshot'
+ AND LogAttributes['shirudo.upatch.name'] = '<upatch>'
+ ORDER BY Timestamp DESC
+ LIMIT 10;
+
+ ``Body`` holds what the map's decoder returned, or the map's entries
+ when the upatch ships no decoder. A decoder that emits metrics writes
+ to the metric tables instead.
+
+Next steps
+----------
+
+- :doc:`/reference/formats/otlp` for every field a target sends
+- :doc:`/upatches/write/decoders` to turn a map into log records or
+ metrics
+- :doc:`grafana` to chart the same data
diff --git a/Documentation/operate/integrations/grafana.rst b/Documentation/operate/integrations/grafana.rst
new file mode 100644
index 00000000..b69a62c8
--- /dev/null
+++ b/Documentation/operate/integrations/grafana.rst
@@ -0,0 +1,116 @@
+..
+ SPDX-License-Identifier: BSD-2-Clause
+ Copyright (c) 2026 Authors of shirudo
+
+:page-type: How-to
+:audience: Operators, SecOps
+
+Export to Grafana
+=================
+
+Show the keepalives, map snapshots and decoder metrics of your targets in
+Grafana, with the log records in Loki and the metrics in Prometheus. Both
+accept OTLP directly, so the collector forwards to them with its
+``otlphttp`` exporter.
+
+Before you begin
+----------------
+
+- Targets that export to a collector, as
+ :doc:`/operate/run/telemetry` describes, with the collector's ``otlp``
+ receiver set up there.
+- An OpenTelemetry Collector built with Go 1.24 or later, which offers
+ the hybrid key exchange the targets require.
+- Loki 3 or later, which stores OTLP attributes as structured metadata.
+- Prometheus 3 or later, for the metrics that decoders emit.
+- Grafana with Loki and Prometheus as data sources.
+
+Set up Loki and Prometheus
+--------------------------
+
+#. In Loki's configuration, keep structured metadata on. Loki 3 enables
+ it by default; an older configuration may turn it off:
+
+ .. code-block:: yaml
+
+ limits_config:
+ allow_structured_metadata: true
+
+#. Start Prometheus with ``--web.enable-otlp-receiver``, and in
+ ``prometheus.yml`` promote the target's host name to a label and accept
+ samples that arrive late:
+
+ .. code-block:: yaml
+
+ otlp:
+ promote_resource_attributes:
+ - host.name
+ storage:
+ tsdb:
+ out_of_order_time_window: 30m
+
+Set up the collector
+--------------------
+
+#. Add the exporters and the pipelines to the collector's configuration,
+ next to the ``otlp`` receiver:
+
+ .. code-block:: yaml
+
+ exporters:
+ otlphttp/loki:
+ endpoint: https://<loki-host>/otlp
+ otlphttp/prometheus:
+ endpoint: https://<prometheus-host>/api/v1/otlp
+
+ service:
+ pipelines:
+ logs:
+ receivers: [otlp]
+ exporters: [otlphttp/loki]
+ metrics:
+ receivers: [otlp]
+ exporters: [otlphttp/prometheus]
+
+ The exporter appends ``/v1/logs`` and ``/v1/metrics`` to each
+ endpoint.
+
+#. Restart the collector.
+
+Check the data
+--------------
+
+#. In Grafana's Explore view with the Loki data source, list the
+ keepalives that do not report ``ok``:
+
+ .. code-block:: text
+
+ {service_name="shirudo"} | shirudo_status != "" | shirudo_status != "ok"
+
+ Loki turns ``service.name`` into the label ``service_name`` and stores
+ the other attributes as structured metadata, with dots turned into
+ underscores: ``shirudo.status`` becomes ``shirudo_status`` and
+ ``host.name`` becomes ``host_name``. Only keepalives carry
+ ``shirudo.status``.
+
+#. Read the map snapshots of one upatch:
+
+ .. code-block:: text
+
+ {service_name="shirudo"} | shirudo_upatch_name = "<upatch>"
+
+#. With the Prometheus data source, select the metrics of one target:
+
+ .. code-block:: text
+
+ {host_name="<target>"}
+
+ Which metrics exist depends on the decoders of the loaded upatches.
+
+Next steps
+----------
+
+- :doc:`/reference/formats/otlp` for every field a target sends
+- :doc:`/upatches/write/decoders` to turn a map into log records or
+ metrics
+- :doc:`clickhouse` to keep the records for longer analysis
diff --git a/Documentation/operate/integrations/index.rst b/Documentation/operate/integrations/index.rst
new file mode 100644
index 00000000..f1b06edc
--- /dev/null
+++ b/Documentation/operate/integrations/index.rst
@@ -0,0 +1,20 @@
+..
+ SPDX-License-Identifier: BSD-2-Clause
+ Copyright (c) 2026 Authors of shirudo
+
+Integrations
+============
+
+Send what targets export into the tools you already run. Targets speak
+OTLP over HTTP with JSON bodies and TLS 1.3 with a hybrid post-quantum
+key exchange, and nothing else. Each page puts an OpenTelemetry Collector
+between the targets and one backend: the collector accepts the targets'
+requests, batches and retries, and speaks the backend's own protocol
+over ordinary TLS, so the backend needs no post-quantum support.
+
+.. toctree::
+ :titlesonly:
+
+ clickhouse
+ splunk
+ grafana
diff --git a/Documentation/operate/integrations/splunk.rst b/Documentation/operate/integrations/splunk.rst
new file mode 100644
index 00000000..d4b8018a
--- /dev/null
+++ b/Documentation/operate/integrations/splunk.rst
@@ -0,0 +1,100 @@
+..
+ SPDX-License-Identifier: BSD-2-Clause
+ Copyright (c) 2026 Authors of shirudo
+
+:page-type: How-to
+:audience: Operators, SecOps
+
+Export to Splunk
+================
+
+Index the keepalives and map snapshots of your targets in Splunk,
+through the OpenTelemetry Collector's Splunk HEC exporter, which sends to
+Splunk's HTTP Event Collector.
+
+Before you begin
+----------------
+
+- Targets that export to a collector, as
+ :doc:`/operate/run/telemetry` describes, with the collector's ``otlp``
+ receiver set up there.
+- The OpenTelemetry Collector Contrib distribution, ``otelcol-contrib``,
+ built with Go 1.24 or later. The contrib distribution includes the
+ Splunk HEC exporter; Go 1.24 offers the hybrid key exchange the
+ targets require.
+- An HTTP Event Collector token, an events index for the log records and,
+ if a decoder emits metrics, a metrics index.
+
+Set up the exporter
+-------------------
+
+#. Add one exporter per index and the pipelines to the collector's
+ configuration, next to the ``otlp`` receiver:
+
+ .. code-block:: yaml
+
+ exporters:
+ splunk_hec/logs:
+ token: ${env:SPLUNK_HEC_TOKEN}
+ endpoint: https://<splunk-host>:8088/services/collector
+ source: shirudo
+ sourcetype: shirudo
+ index: shirudo
+ tls:
+ ca_file: /etc/otelcol/splunk-ca.pem
+ splunk_hec/metrics:
+ token: ${env:SPLUNK_HEC_TOKEN}
+ endpoint: https://<splunk-host>:8088/services/collector
+ source: shirudo
+ sourcetype: shirudo
+ index: shirudo_metrics
+ tls:
+ ca_file: /etc/otelcol/splunk-ca.pem
+
+ service:
+ pipelines:
+ logs:
+ receivers: [otlp]
+ exporters: [splunk_hec/logs]
+ metrics:
+ receivers: [otlp]
+ exporters: [splunk_hec/metrics]
+
+ ``SPLUNK_HEC_TOKEN`` comes from the collector's environment, and
+ ``ca_file`` names the CA that signed the HEC endpoint's certificate.
+ The exporter takes each event's host from the ``host.name`` resource
+ attribute, so every event carries the name of the target that sent
+ it.
+
+#. Restart the collector.
+
+Check the data
+--------------
+
+#. Search for the events of one target:
+
+ .. code-block:: text
+
+ index=shirudo sourcetype=shirudo host=<target>
+
+ A target sends a keepalive every few seconds, so each target shows up
+ within a minute of the restart.
+
+#. List when each target last reported:
+
+ .. code-block:: text
+
+ index=shirudo sourcetype=shirudo
+ | stats latest(_time) AS last_seen BY host
+ | sort last_seen
+
+ A target at the top whose ``last_seen`` falls behind has stopped
+ sending. :doc:`/operate/run/telemetry` describes what else to alert
+ on.
+
+Next steps
+----------
+
+- :doc:`/reference/formats/otlp` for every field a target sends
+- :doc:`/upatches/write/decoders` to turn a map into log records or
+ metrics
diff --git a/Documentation/operate/run/telemetry.rst b/Documentation/operate/run/telemetry.rst
index 00ab7ca4..63f71bc7 100644
--- a/Documentation/operate/run/telemetry.rst
+++ b/Documentation/operate/run/telemetry.rst
@@ -265,7 +265,9 @@ reboot.
exporters: [debug]
The ``debug`` exporter prints what arrives. Replace it with the
- exporters for your storage once records arrive. A collector built
+ exporters for your storage once records arrive;
+ :doc:`/operate/integrations/index` sets up ClickHouse, Splunk and
+ Grafana. A collector built
with Go 1.24 or later offers ``X25519MLKEM768`` by default.
#. Restart the collector.