rsyslog/tests/impstats-push-tls-missing-key.sh
Rainer Gerhards c253fc36cc
impstats: add VictoriaMetrics push via Remote Write
Adds first-class integration with VictoriaMetrics to simplify ops
dashboards and move toward project-supported telemetry without
sidecar collectors.

Impact: New optional feature (off by default). No behavior change
unless configured via push.* parameters.

Before: impstats could only log locally or emit text formats.
After: impstats can push counters to Prometheus-compatible endpoints.

Technical: implement a native Prometheus Remote Write path in
impstats, encoding counters to protobuf and compressing with snappy
over HTTP via libcurl. Replace interim text parsing with a new
statsobj v14 API (GetAllCounters) that iterates raw uint64 counters,
keeps atomic reads for IntCtr and best-effort reads for Int. Add
metric builder with Prometheus-compliant sanitization and the naming
pattern <origin>_<name>_<counter>_total. Provide TLS knobs (CA, mTLS,
insecureSkipVerify), static/dynamic labels, timeout, and optional
batching by bytes/series. Build is gated behind
--enable-impstats-push with protobuf-c/snappy/curl checks. Ship docs,
basic/VM integration tests, and a GitHub Actions workflow using a
VictoriaMetrics service; TSAN jobs disable impstats-push.

Configuration: push.url, push.labels, push.timeout.ms,
push.label.{instance,job,origin,name}, push.tls.{cafile,certfile,
keyfile,insecureSkipVerify}, push.batch.{maxBytes,maxSeries}.

With the Help of AI Agents: ChatGPT codex 5.2
2026-02-06 16:02:08 +01:00

38 lines
965 B
Bash
Executable File

#!/bin/bash
# Test for impstats push TLS validation - missing keyfile
# This file is part of the rsyslog project, released under ASL 2.0
. ${srcdir:=.}/diag.sh init
skip_platform "SunOS" "Solaris has limitations"
export RS_REDIR="2>$RSYSLOG_DYNNAME.err.log"
generate_conf
add_conf '
module(load="../plugins/impstats/.libs/impstats"
interval="1"
format="prometheus"
log.file="'"$RSYSLOG_OUT_LOG"'"
resetCounters="off"
# Push config (TLS validation)
push.url="https://localhost:8428/api/v1/write"
push.tls.certfile="/etc/ssl/certs/ca-certificates.crt"
)
action(type="omfile" file=`echo $RSYSLOG2_OUT_LOG`)
'
startup
sleep 1
shutdown_when_empty
wait_shutdown
if ! grep -q "push.tls.certfile is set but push.tls.keyfile is missing" "$RSYSLOG_DYNNAME.err.log"; then
echo "FAIL: expected TLS missing keyfile error in $RSYSLOG_DYNNAME.err.log"
cat -n "$RSYSLOG_DYNNAME.err.log" || true
error_exit 1
fi
exit_test