|
| 1 | +--- |
| 2 | +layout: docs |
| 3 | +menu: |
| 4 | + docsplatform_{{.version}}: |
| 5 | + identifier: cluster-management-telemetry-data-check |
| 6 | + name: Verifying Telemetry Data |
| 7 | + parent: cluster-management |
| 8 | + weight: 100 |
| 9 | +menu_name: docsplatform_{{.version}} |
| 10 | +section_menu_id: guides |
| 11 | +--- |
| 12 | + |
| 13 | +# Verifying Telemetry Data (Logs & Metrics) |
| 14 | + |
| 15 | +This guide shows how to confirm your logs and metrics are actually being stored — not just |
| 16 | +collected — in the monitoring stack: **ClickHouse** for logs, **Thanos + S3** for metrics. |
| 17 | +See [OpenTelemetry Monitoring](otel-monitoring.md) for how the stack is set up. |
| 18 | + |
| 19 | +## Basics |
| 20 | + |
| 21 | +- Logs and metrics are stored in the **same S3 bucket**, under different prefixes: |
| 22 | + - Logs → `<bucket>/logs/` |
| 23 | + - Metrics → `<bucket>/metrics/` |
| 24 | +- Bucket, endpoint, and prefixes are defined in your `TelemetryStack` resource: |
| 25 | + ```bash |
| 26 | + kubectl get telemetrystack -n monitoring -o yaml |
| 27 | + ``` |
| 28 | + Look under `spec.logs.clickhouse.s3` and `spec.metrics.thanos.s3`. |
| 29 | +- ClickHouse database name is your tenant ID, not a fixed name like `otel` or `default`. |
| 30 | + Find it with `SHOW DATABASES` (see below) — the table inside is `otel_logs`. |
| 31 | +- All checks below run from inside the cluster via `kubectl exec`, so no port-forwarding |
| 32 | + or extra credentials are required except for the optional S3 listing step. |
| 33 | + |
| 34 | +--- |
| 35 | + |
| 36 | +## 1. Check logs are landing in ClickHouse |
| 37 | + |
| 38 | +Find the ClickHouse pod: |
| 39 | + |
| 40 | +```bash |
| 41 | +kubectl get pods -n monitoring -l app.kubernetes.io/name=clickhouse |
| 42 | +``` |
| 43 | + |
| 44 | +List databases and confirm the `otel_logs` table exists: |
| 45 | + |
| 46 | +```bash |
| 47 | +kubectl exec -n monitoring <clickhouse-pod> -- clickhouse-client --query "SHOW DATABASES" |
| 48 | +kubectl exec -n monitoring <clickhouse-pod> -- clickhouse-client --query "SHOW TABLES FROM <your-tenant-db>" |
| 49 | +``` |
| 50 | + |
| 51 | +Check row count and freshness: |
| 52 | + |
| 53 | +```bash |
| 54 | +kubectl exec -n monitoring <clickhouse-pod> -- clickhouse-client --query \ |
| 55 | + "SELECT count(), min(Timestamp), max(Timestamp), now() FROM <your-tenant-db>.otel_logs" |
| 56 | + |
| 57 | +kubectl exec -n monitoring <clickhouse-pod> -- clickhouse-client --query \ |
| 58 | + "SELECT count() FROM <your-tenant-db>.otel_logs WHERE Timestamp > now() - INTERVAL 5 MINUTE" |
| 59 | +``` |
| 60 | + |
| 61 | +**Healthy result:** `max(Timestamp)` is close to `now()`, and the 5-minute count is greater |
| 62 | +than zero. If both queries return recent data, logs are flowing end-to-end. |
| 63 | + |
| 64 | +--- |
| 65 | + |
| 66 | +## 2. Check metrics are landing in Thanos / S3 |
| 67 | + |
| 68 | +Find the Thanos query pod: |
| 69 | + |
| 70 | +```bash |
| 71 | +kubectl get pods -n monitoring -l app.kubernetes.io/name=thanos-query |
| 72 | +``` |
| 73 | + |
| 74 | +Ask it which StoreAPIs it's talking to and what time range each one covers: |
| 75 | + |
| 76 | +```bash |
| 77 | +kubectl exec -n monitoring <thanos-query-pod> -- \ |
| 78 | + wget -qO- --header="THANOS-TENANT: <your-tenant>" "http://localhost:9090/api/v1/stores" |
| 79 | +``` |
| 80 | + |
| 81 | +Look at the `minTime`/`maxTime` fields (Unix epoch **milliseconds**) for each store: |
| 82 | + |
| 83 | +```bash |
| 84 | +date -u -d @<maxTime-in-seconds> # drop the last 3 digits first to convert ms -> s |
| 85 | +``` |
| 86 | + |
| 87 | +**Healthy result:** `maxTime` should be within the last few minutes for the live/receive |
| 88 | +store, and within your compaction interval for the long-term S3-backed store. |
| 89 | + |
| 90 | +For a second confirmation, check the ingester's own TSDB head timestamp: |
| 91 | + |
| 92 | +```bash |
| 93 | +kubectl get pods -n monitoring -l app.kubernetes.io/name=thanos-receive-ingester |
| 94 | +kubectl exec -n monitoring <thanos-receive-ingester-pod> -- wget -qO- http://localhost:10902/metrics \ |
| 95 | + | grep prometheus_tsdb_head_max_time |
| 96 | +``` |
| 97 | + |
| 98 | +If this timestamp is stale (not advancing over successive checks), metrics are not being |
| 99 | +ingested. Check that Prometheus (or your agent) has `remoteWrite` configured to point at |
| 100 | +the Thanos receive router: |
| 101 | + |
| 102 | +```bash |
| 103 | +kubectl get prometheus -n monitoring <prometheus-name> -o jsonpath='{.spec.remoteWrite}' |
| 104 | +``` |
| 105 | + |
| 106 | +An empty result means nothing is shipping samples to Thanos, regardless of whether |
| 107 | +Prometheus itself is scraping normally. |
| 108 | + |
| 109 | +--- |
| 110 | + |
| 111 | +## 3. Check the S3 bucket directly (optional) |
| 112 | + |
| 113 | +Use the MinIO/S3 client (`mc` or `aws s3`) with your access credentials from the |
| 114 | +`TelemetryStack` spec: |
| 115 | + |
| 116 | +```bash |
| 117 | +kubectl run mc-check -n monitoring --rm -it --restart=Never --image=minio/mc:latest -- sh |
| 118 | +mc alias set myminio <endpoint> <accessKey> <secretKey> --insecure |
| 119 | +mc ls myminio/<bucket>/logs/ --insecure --recursive | tail |
| 120 | +mc ls myminio/<bucket>/metrics/ --insecure --recursive | tail |
| 121 | +``` |
| 122 | + |
| 123 | +**Healthy result:** recent objects under both prefixes, with timestamps matching your |
| 124 | +retention/compaction schedule. |
| 125 | + |
| 126 | +--- |
| 127 | + |
| 128 | +## Summary |
| 129 | + |
| 130 | +| Pipeline | Where to look | Healthy signal | |
| 131 | +|---|---|---| |
| 132 | +| Logs | ClickHouse `<tenant-db>.otel_logs` | `max(Timestamp)` ≈ now, non-zero rows in last 5 min | |
| 133 | +| Metrics | Thanos Query `/api/v1/stores`, receive ingester `/metrics` | `maxTime`/head timestamp advancing, close to now | |
| 134 | +| S3 | `<bucket>/logs/` and `<bucket>/metrics/` prefixes | Recent objects under both prefixes | |
| 135 | + |
| 136 | +--- |
| 137 | + |
| 138 | +## Worked example: diagnosing a broken metrics pipeline |
| 139 | + |
| 140 | +The steps above surfaced a real split-brain state on a monitoring cluster: logs healthy, |
| 141 | +metrics stale for four days. This walks through how the checks pinpointed the cause. |
| 142 | + |
| 143 | +**Logs check** — healthy: |
| 144 | + |
| 145 | +```bash |
| 146 | +kubectl exec -n monitoring telemetry-stack-clickhouse-0 -- clickhouse-client --query \ |
| 147 | + "SELECT count(), min(Timestamp), max(Timestamp), now() FROM ace_user_3.otel_logs" |
| 148 | +# → 60.7M rows, max(Timestamp) == now(), 11,638 rows in the last 5 minutes |
| 149 | +``` |
| 150 | + |
| 151 | +**Metrics check** — broken: |
| 152 | + |
| 153 | +- `thanos-query` `/api/v1/stores`: the `receive` StoreAPI reported sentinel min/max |
| 154 | + timestamps (i.e. no live head data at all). The `store` StoreAPI (long-term, backed by S3) |
| 155 | + reported `maxTime=1783742913242` ms → `2026-07-11T04:08:33Z`, four days stale. |
| 156 | +- `thanos-receive-ingester` `/metrics`: `prometheus_tsdb_head_max_time{tenant="ace.user.3"}` |
| 157 | + matched that same stale timestamp; a `tenant="default-tenant"` series showed sentinel |
| 158 | + values, meaning it had never received anything. |
| 159 | +- `thanos-receive-ingester` logs: last `"Uploaded head block"` line was |
| 160 | + `2026-07-11T08:00:49Z`; every 4h afterward only `"Running pruning job"` appeared, alongside |
| 161 | + a recurring error: |
| 162 | + ``` |
| 163 | + msg="Failed to calculate size of \"chunks_head\" dir" err="lstat /var/thanos/receive/ace.user.3/chunks_head: no such file or directory" |
| 164 | + ``` |
| 165 | + |
| 166 | +**Root cause** — checking the Prometheus CR's remote-write config confirmed nothing was |
| 167 | +shipping samples: |
| 168 | + |
| 169 | +```bash |
| 170 | +kubectl get prometheus -n monitoring kube-prometheus-stack-prometheus -o jsonpath='{.spec.remoteWrite}' |
| 171 | +# → (empty) |
| 172 | +``` |
| 173 | + |
| 174 | +Prometheus itself was scraping fine locally (`prometheus_remote_storage_highest_timestamp_in_seconds` |
| 175 | +== now), but with `spec.remoteWrite` unset there was nothing pointing samples at the Thanos |
| 176 | +receive router. No `PrometheusAgent` resources existed either, so no other component was |
| 177 | +doing remote-write in its place. |
| 178 | + |
| 179 | +**Fix** — add `spec.remoteWrite` to the `Prometheus` CR, pointing at the Thanos receive |
| 180 | +router's remote-write endpoint (`http://thanos-receive-router-<stack>.monitoring.svc:19291/api/v1/receive`) |
| 181 | +with the tenant header the router's hashring expects (e.g. `THANOS-TENANT: <tenant>`). After |
| 182 | +applying, re-run the `prometheus_tsdb_head_max_time` check above over a couple of minutes to |
| 183 | +confirm the timestamp starts advancing. |
| 184 | + |
| 185 | +**Takeaway:** a healthy logs pipeline says nothing about the metrics pipeline (or vice |
| 186 | +versa) — they're independent paths through the same `TelemetryStack`, so always check both |
| 187 | +per the steps above rather than assuming one implies the other. |
0 commit comments