Send Logs from Vector to SigNoz
This guide explains how to forward logs from Vector to SigNoz.
Configure Vector
We will configure vector to send logs to SigNoz Cloud
Prerequisites
- Vector running on your system
Setup
Follow these steps to set up Vector for forwarding logs to SigNoz Cloud:
- Open your Vector configuration file (usually
config.yaml
) - Add the following sink configuration to the file:
signoz_sink: type: http inputs: - <SOURCE_NAME> uri: https://ingest.<REGION>.signoz.cloud/logs/vector encoding: codec: json request: headers: signoz-ingestion-key: "<SIGNOZ_INGESTION_KEY>"
<SOURCE_NAME>
: The name of your Vector source (e.g., docker)
<REGION>
: Region of your SigNoz Cloud tenant
<SIGNOZ_INGESTION_KEY>
: SigNoz Cloud ingestion key
Save the configuration file and restart Vector to apply the changes.
Log Mapping for SigNoz
SigNoz processes incoming logs from Vector as follows:
- The
timestamp
field is automatically parsed. - The
source_type
is moved to resource attributes. - The
message
key is mapped to thebody
field.
OpenTelemetry (OTEL) Schema Transformation
You can consider transforming your logs to the OpenTelemetry schema at the Vector level. The OTEL schema structure is as follows:
{
"trace_id": "<hex string>",
"span_id": "<hex string>",
"trace_flags": "<int>",
"severity_text": "<string>",
"severity_number": "<int>",
"attributes": "<map>",
"resources": "<map>",
"source_type": "<string>",
"message": "<string>"
}
Example of a transformed log entry:
{
"trace_id": "000000000000000018c51935df0b93b9",
"span_id": "18c51935df0b93b9",
"trace_flags": 0,
"severity_text": "info",
"severity_number": 4,
"attributes": {
"method": "GET",
"path": "/api/users"
},
"resources": {
"host": "myhost",
"namespace": "prod"
},
"source_type": "docker",
"message": "This is a log line"
}
Note: Any fields not included in the OTEL schema will be automatically moved to log attributes by SigNoz.
If you prefer not to transform logs at Vector level, you can use SigNoz pipelines for processing the logs.