VictoriaLogs supports both client open-telemetry SDK and collector.
Client SDK #
Specify EndpointURL
for http-exporter builder to /insert/opentelemetry/v1/logs
.
Consider the following example for Go SDK:
logExporter, err := otlploghttp.New(ctx,
otlploghttp.WithEndpointURL("http://victorialogs:9428/insert/opentelemetry/v1/logs"),
)
VictoriaLogs treats all the resource labels as log stream fields.
The list of log stream fields can be overriden via VL-Stream-Fields
HTTP header if needed. For example, the following config uses only host
and app
labels as log stream fields, while the remaining labels are stored as regular log fields:
logExporter, err := otlploghttp.New(ctx,
otlploghttp.WithEndpointURL("http://victorialogs:9428/insert/opentelemetry/v1/logs"),
otlploghttp.WithHeaders(map[string]string{
"VL-Stream-Fields": "host,app",
}),
)
VictoriaLogs supports other HTTP headers - see the list here.
The ingested log entries can be queried according to these docs.
Collector configuration #
VictoriaLogs supports receiving logs from the following OpenTelemetry collectors:
Elasticsearch #
exporters:
elasticsearch:
endpoints:
- http://victorialogs:9428/insert/elasticsearch
receivers:
filelog:
include: [/tmp/logs/*.log]
resource:
region: us-east-1
service:
pipelines:
logs:
receivers: [filelog]
exporters: [elasticsearch]
If Elasticsearch stores the log message in the field other than _msg
,
then it can be moved to _msg
field by using the VL-Msg-Field
HTTP header. For example, if the log message is stored in the Body
field,
then it can be moved to _msg
field via the following config:
exporters:
elasticsearch:
endpoints:
- http://victorialogs:9428/insert/elasticsearch
headers:
VL-Msg-Field: Body
VictoriaLogs supports other HTTP headers - see the list here.
Loki #
exporters:
loki:
endpoint: http://victorialogs:9428/insert/loki/api/v1/push
receivers:
filelog:
include: [/tmp/logs/*.log]
resource:
region: us-east-1
service:
pipelines:
logs:
receivers: [filelog]
exporters: [loki]
OpenTelemetry #
Specify logs endpoint for OTLP/HTTP exporter in configuration file for sending the collected logs to VictoriaLogs:
exporters:
otlphttp:
logs_endpoint: http://localhost:9428/insert/opentelemetry/v1/logs
VictoriaLogs supports various HTTP headers, which can be used during data ingestion - see the list here.
These headers can be pssed to OpenTelemetry exporter config via headers
options. For example, the following config instructs ignoring foo
and bar
fields during data ingestion:
exporters:
otlphttp:
logs_endpoint: http://localhost:9428/insert/opentelemetry/v1/logs
headers:
VL-Ignore-Fields: foo,bar
See also: