docs/victorialogs: change fluentd input type in examples (#7123)

### Describe Your Changes

Use fluentd logging driver in examples to have enriched data in
VictoriaLogs

### Checklist

The following checks are **mandatory**:

- [ ] My change adheres [VictoriaMetrics contributing
guidelines](https://docs.victoriametrics.com/contributing/).
This commit is contained in:
Andrii Chubatiuk 2024-09-27 16:09:36 +03:00 committed by Aliaksandr Valialkin
parent 660f4276c9
commit 3df920c60d
No known key found for this signature in database
GPG key ID: 52C003EE2BCDB9EB
5 changed files with 44 additions and 15 deletions

View file

@ -1,6 +1,8 @@
FROM fluent/fluentd:v1.17 FROM fluent/fluentd:v1.17-debian-1
USER root USER root
RUN \ RUN \
apt update && \
apt install -y netcat-traditional && \
gem install \ gem install \
fluent-plugin-datadog \ fluent-plugin-datadog \
fluent-plugin-grafana-loki \ fluent-plugin-grafana-loki \

View file

@ -9,3 +9,22 @@ services:
depends_on: [victorialogs] depends_on: [victorialogs]
ports: ports:
- "5140:5140" - "5140:5140"
- "24224:24224"
healthcheck:
test: ["CMD", "nc", "-z", "-n", "-v", "127.0.0.1", "24224"]
start_period: 3s
nginx:
image: nginx:1.27
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost"]
start_period: 3s
ports:
- "8080:80"
logging:
driver: fluentd
options:
fluentd-address: 127.0.0.1:24224
labels: com.docker.compose.service
depends_on:
fluentd:
condition: service_healthy

View file

@ -1,13 +1,13 @@
<source> <source>
@type tail @type forward
format none port 24224
tag docker.testlog bind 0.0.0.0
path /var/lib/docker/containers/**/*.log
</source> </source>
<match **> <match **>
@type elasticsearch @type elasticsearch
host victorialogs host victorialogs
path /insert/elasticsearch path /insert/elasticsearch
custom_headers {"VL-Msg-Field": "log", "VL-Stream-Fields": "com.docker.compose.service"}
port 9428 port 9428
</match> </match>

View file

@ -1,12 +1,11 @@
<source> <source>
@type tail @type forward
format none port 24224
tag docker.testlog bind 0.0.0.0
path /var/lib/docker/containers/**/*.log
</source> </source>
<match **> <match **>
@type http @type http
endpoint "http://victorialogs:9428/insert/jsonline" endpoint "http://victorialogs:9428/insert/jsonline"
headers {"VL-Msg-Field": "log", "VL-Time-Field": "time", "VL-Stream-Fields": "path"} headers {"VL-Msg-Field": "log", "VL-Stream-Fields": "com.docker.compose.service"}
</match> </match>

View file

@ -1,10 +1,17 @@
<source> <source>
@type tail @type forward
format none port 24224
tag docker.testlog bind 0.0.0.0
path /var/lib/docker/containers/**/*.log
</source> </source>
<filter **>
@type record_transformer
enable_ruby true
<record>
service ${record['com.docker.compose.service']}
</record>
</filter>
<match **> <match **>
@type loki @type loki
url "http://victorialogs:9428/insert" url "http://victorialogs:9428/insert"
@ -12,6 +19,8 @@
flush_interval 10s flush_interval 10s
flush_at_shutdown true flush_at_shutdown true
</buffer> </buffer>
custom_headers {"VL-Msg-Field": "log", "VL-Time-Field": "time", "VL-Stream-Fields": "path"} <label>
service
</label>
buffer_chunk_limit 1m buffer_chunk_limit 1m
</match> </match>