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
RUN \
apt update && \
apt install -y netcat-traditional && \
gem install \
fluent-plugin-datadog \
fluent-plugin-grafana-loki \

View file

@ -9,3 +9,22 @@ services:
depends_on: [victorialogs]
ports:
- "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>
@type tail
format none
tag docker.testlog
path /var/lib/docker/containers/**/*.log
@type forward
port 24224
bind 0.0.0.0
</source>
<match **>
@type elasticsearch
host victorialogs
path /insert/elasticsearch
custom_headers {"VL-Msg-Field": "log", "VL-Stream-Fields": "com.docker.compose.service"}
port 9428
</match>

View file

@ -1,12 +1,11 @@
<source>
@type tail
format none
tag docker.testlog
path /var/lib/docker/containers/**/*.log
@type forward
port 24224
bind 0.0.0.0
</source>
<match **>
@type http
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>

View file

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