Collect Telemetry Data from External Clients to VictoriaMetrics and VictoriaLogs¶
Stream telemetry metrics and logs from external client nodes to VictoriaMetrics and VictoriaLogs deployed in the Service Kubernetes cluster.
Overview¶
This procedure describes how to collect telemetry data from external client nodes and stream it to VictoriaMetrics (cluster mode) and VictoriaLogs (cluster mode) in the Service Kubernetes cluster.
- VictoriaMetrics -- Accepts Prometheus remote write and import endpoints for metrics ingestion.
- VictoriaLogs -- Accepts syslog (plaintext and TLS) and HTTP forwarding for log ingestion.
Prerequisites¶
This is a post-deployment procedure. The Omnia telemetry stack (including VictoriaMetrics and VictoriaLogs) must already be deployed and running before you connect external clients.
- A Service Kubernetes cluster is running with VictoriaMetrics deployed in the
telemetrynamespace. pod_external_ip_rangeis set inomnia_config.ymlso MetalLB can assign external IPs to thevminsert,vmselect, and VictoriaLogs services.- External access to VictoriaMetrics is available through:
- LoadBalancer port
8480for ingesting (inserting) data. - LoadBalancer port
8481for querying data.
- LoadBalancer port
- VictoriaLogs is deployed in cluster mode in the
telemetrynamespace (for log collection). - Network connectivity exists from external log sources to the Service Kubernetes cluster.
Important
Ensure that pod_external_ip_range in omnia_config.yml is reachable from external log sources.
Collect Metrics to VictoriaMetrics¶
Step 1: Retrieve VictoriaMetrics Connection Details¶
Run the following playbook to retrieve the VictoriaMetrics connection details and TLS certificate from the Service Kubernetes cluster:
cd /omnia/utils
ansible-playbook external_victoria_connect_details.yml
The external_victoria_connect_details.yml playbook does the following:
- Retrieves the VictoriaMetrics
vminsertandvmselectLoadBalancer IPs. - Extracts the server CA certificate for TLS.
- Writes the connection details to
/omnia/utils/external_victoria_connect_details.yml. - Saves the CA certificate at
/omnia/utils/victoria-certs/ca.crt.
Step 2: Push Sample Metrics from the Omnia Core Container¶
-
Add the LoadBalancer insert and select IP addresses to
/etc/hosts:Run on omnia_core containerecho "<vminsert-IP> vminsert.telemetry.svc.cluster.local" >> /etc/hosts echo "<vmselect-IP> vmselect.telemetry.svc.cluster.local" >> /etc/hostsFor
vminsertandvmselectIP, use the values retrieved by theexternal_victoria_connect_details.ymlplaybook.Note
The
/etc/hostsupdate must be repeated if the SFM Prometheus pod restarts. -
Create a new test metric:
Run on omnia_core containercurl --cacert ca.crt -X POST \ "https://vminsert.telemetry.svc.cluster.local:8480/insert/0/prometheus/api/v1/import/prometheus" \ -H "Content-Type: text/plain" \ -d "test_metric{source=\"external\"} 42"Note
Use
https://vminsert.telemetry.svc.cluster.local:8480/insert/0/prometheus/api/v1/writeto push the metrics from an external client, such as Smart Fabric Manager (SFM). For collecting telemetry data from SFM to Victoria DB, see SFM Telemetry. -
Push sample test metrics to Victoria DB:
Run on omnia_core containercurl --cacert ca.crt -X POST \ "https://vminsert.telemetry.svc.cluster.local:8480/insert/0/prometheus/api/v1/import/prometheus" \ -H "Content-Type: text/plain" \ -d 'cpu_usage{host="server1",job="new"} 75.5 memory_usage{host="server1",job="new"} 1024 disk_usage{host="server1",job="new"} 512 network_rx{host="server1",interface="eth0"} 1000000 network_tx{host="server1",interface="eth0"} 500000' -
Query the inserted data from Victoria DB:
Run on omnia_core containercurl --cacert ca.crt -s \ "https://vmselect.telemetry.svc.cluster.local:8481/select/0/prometheus/api/v1/query?query=new_metric" curl --cacert ca.crt -s \ "https://vmselect.telemetry.svc.cluster.local:8481/select/0/prometheus/api/v1/query_range?query=cpu_usage&start=$(date -d '1 hour ago' +%s)&end=$(date +%s)&step=600s"
Collect Logs to VictoriaLogs¶
Step 1: Obtain Endpoint Information¶
Retrieve the VLAgent endpoint information from the VictoriaLogs deployment.
-
Check the
vlagentLoadBalancer service to get the external IP:Run on K8s control planekubectl get svc vlagent -n telemetry -
Record the following endpoints:
- Syslog plaintext:
<LoadBalancer IP>:514 - Syslog TLS:
<LoadBalancer IP>:6514 - HTTP forwarder:
https://<LoadBalancer IP>:9481/insert/jsonline
- Syslog plaintext:
-
Retrieve the TLS CA certificate from the
victoria-tls-certssecret:Run on K8s control planekubectl get secret victoria-tls-certs -n telemetry -o jsonpath='{.data.ca\.crt}' | base64 -d > victoria-ca.crt
Note
VLAgent provides platform-managed syslog receivers. No additional configuration is needed on the Omnia side.
Step 2: Configure Syslog Sources¶
Configure external devices to send syslog messages to VLAgent.
Plaintext Syslog (Port 514)
- Access the configuration interface of your log source device.
-
Configure syslog forwarding to the VLAgent plaintext endpoint.
Example configuration:
Syslog server: <LoadBalancer IP> Port: 514 Protocol: TCP or UDP
Note
DNS mapping may be required in some devices for TLS certificate validation. Use the LoadBalancer IP if DNS is not configured.
TLS Syslog (Port 6514)
- Copy the VictoriaLogs CA certificate to the log source device.
- Access the configuration interface of your log source device.
-
Configure syslog forwarding to the VLAgent TLS endpoint.
Example configuration:
Syslog server: <LoadBalancer IP> Port: 6514 Protocol: TCP TLS: Enabled CA certificate: victoria-ca.crt -
Verify TLS handshake:
Run on external client nodeopenssl s_client -connect <LoadBalancer IP>:6514 -CAfile victoria-ca.crt
Step 3: Configure HTTP Forwarding Sources¶
Configure log sources that support HTTP forwarding to send logs in JSON Lines format to the vlinsert endpoint.
-
Configure HTTP log forwarding to the vlinsert endpoint.
Example configuration:
Endpoint URL: https://<LoadBalancer IP>:9481/insert/jsonline Method: POST Format: JSON Lines Headers: Content-Type: application/json -
Example JSON Lines payload format:
{"time":"2024-01-01T12:00:00Z","stream":"device-01","_msg":"System started"} {"time":"2024-01-01T12:01:00Z","stream":"device-01","_msg":"Connection established"}
Note
The vlinsert endpoint expects one JSON object per line (JSON Lines format).
Step 4: Verify Log Ingestion¶
-
Access the VictoriaLogs query interface:
Run on K8s control plane or omnia_core containercurl -k https://<LoadBalancer IP>:9491/select/logsql/query -d 'query="{}"' -
Query for logs from a configured source:
query="{_stream='device-01'}" -
Verify that logs from the external source appear in the query results.
Note
Query latency depends on time range and data volume. Narrow the time range for faster results.
Note
VictoriaLogs does not return an error when log entries with timestamps outside the configured retention window are submitted. Log entries will be automatically removed from VictoriaLogs after the retention period.
Next Steps¶
- External Kafka -- Stream data from external clients to Kafka.
- Setup Telemetry -- Overview of all telemetry sources.