docs: [VictoriaLogs] OTel Collector elasticsearchexporter header note (#7074)

### Describe Your Changes

By default, the `elasticsearchexporter` in OTel Collector puts the log
message under a field other than `_msg` (e.g., `Body`). Without
specifying via an HTTP header, those logs may not be queried correctly.
See also:
https://github.com/VictoriaMetrics/VictoriaMetrics/issues/6785.

This pull request updates the example configuration and notes for the
`elasticsearchexporter`.

### Checklist

The following checks are **mandatory**:

- [X] My change adheres [VictoriaMetrics contributing
guidelines](https://docs.victoriametrics.com/contributing/).
This commit is contained in:
Zhu Jiekun 2024-09-24 17:52:09 +08:00 committed by GitHub
parent 91b28d0527
commit fea4433362
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -56,6 +56,8 @@ exporters:
elasticsearch: elasticsearch:
endpoints: endpoints:
- http://victorialogs:9428/insert/elasticsearch - http://victorialogs:9428/insert/elasticsearch
headers:
VL-Msg-Field: "Body" # Optional.
receivers: receivers:
filelog: filelog:
include: [/tmp/logs/*.log] include: [/tmp/logs/*.log]
@ -68,6 +70,15 @@ service:
exporters: [elasticsearch] exporters: [elasticsearch]
``` ```
Please note that every ingested log entry **must** contain at least a `_msg` field with the actual log message. By default,
the Elasticsearch exporter may place the log message in the `Body` field. In this case, you can specify the field mapping via:
```yaml
headers:
VL-Msg-Field: "Body"
```
VictoriaLogs also support specify `AccountID`, `ProjectID`, log timestamp and other fields via [HTTP headers](https://docs.victoriametrics.com/victorialogs/data-ingestion/#http-headers).
### Loki ### Loki
```yaml ```yaml
@ -104,7 +115,7 @@ exporters:
otlphttp: otlphttp:
logs_endpoint: http://localhost:9428/insert/opentelemetry/v1/logs logs_endpoint: http://localhost:9428/insert/opentelemetry/v1/logs
headers: headers:
VL-Stream-Fields: telemetry.sdk.language,severity VL-Stream-Fields: telemetry.sdk.language,severity
``` ```
See also [HTTP headers](https://docs.victoriametrics.com/victorialogs/data-ingestion/#http-headers) See also [HTTP headers](https://docs.victoriametrics.com/victorialogs/data-ingestion/#http-headers)