deployment: restructure victorialogs examples (#6971)

### Describe Your Changes

- Use common compose.yaml file for all victorialogs setups to set
version in a single place and override it on demand for each agent and
protocol
- Replaced multiple victorialogs instances in HA setup with single setup
with `deploy.replica` parameter set
- Added fluentd setup

### 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-25 19:33:26 +03:00 committed by GitHub
parent 612be0954c
commit e75ae1b274
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
95 changed files with 705 additions and 1282 deletions

View file

@ -0,0 +1,4 @@
services:
victorialogs-2:
deploy:
replicas: 1

View file

@ -1,49 +1,47 @@
services:
telegraf:
image: bitnami/telegraf:1.31.0
restart: on-failure
volumes:
- type: bind
source: /var/run/docker.sock
target: /var/run/docker.sock
- type: bind
source: /var/lib/docker
target: /var/lib/docker
- ./telegraf.conf:/etc/telegraf/telegraf.conf:ro
command: --config /etc/telegraf/telegraf.conf
depends_on:
victorialogs:
condition: service_healthy
victoriametrics:
condition: service_healthy
victorialogs:
# meta service will be ignored by compose
.victorialogs:
image: docker.io/victoriametrics/victoria-logs:v0.29.0-victorialogs
volumes:
- victorialogs-vector-docker-vl:/vlogs
ports:
- '9428:9428'
command:
- -storageDataPath=/vlogs
- -loggerFormat=json
- -syslog.listenAddr.tcp=0.0.0.0:8094
deploy:
replicas: 0
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:9428/health"]
interval: 1s
timeout: 1s
retries: 10
victorialogs:
extends: .victorialogs
ports:
- '9428:9428'
volumes:
- victorialogs:/vlogs
deploy:
replicas: 1
# second replica is needed for HA setup and its replica count is set to 1 in compose-ha.yaml file
victorialogs-2:
extends: .victorialogs
ports:
- '9429:9428'
volumes:
- victorialogs-2:/vlogs
deploy:
replicas: 0
victoriametrics:
image: victoriametrics/victoria-metrics:latest
ports:
- '8428:8428'
command:
- -storageDataPath=/vmsingle
- -promscrape.config=/promscrape.yml
- -loggerFormat=json
volumes:
- victorialogs-vector-docker-vm:/vmsingle
- ./scrape.yml:/promscrape.yml
- victoriametrics:/vmsingle
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:8428/health"]
interval: 1s
@ -51,5 +49,6 @@ services:
retries: 10
volumes:
victorialogs-vector-docker-vl:
victorialogs-vector-docker-vm:
victorialogs:
victorialogs-2:
victoriametrics:

View file

@ -1,45 +0,0 @@
# Docker compose Filebeat integration with VictoriaLogs for syslog
The folder contains the example of integration of [filebeat](https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-overview.html) with Victorialogs
To spin-up environment run the following command:
```
docker compose up -d
```
To shut down the docker-compose environment run the following command:
```
docker compose down
docker compose rm -f
```
The docker compose file contains the following components:
* filebeat - fileabeat is configured to accept `syslog` logs in `rfc3164` format on `5140` port, you can find configuration in the `filebeat.yml`. It writes data in VictoriaLogs
* VictoriaLogs - the log database, it accepts the data from `filebeat` by elastic protocol
Querying the data
* [vmui](https://docs.victoriametrics.com/victorialogs/querying/#vmui) - a web UI is accessible by `http://localhost:9428/select/vmui`
* for querying the data via command-line please check [these docs](https://docs.victoriametrics.com/victorialogs/querying/#command-line)
the example of filebeat configuration(`filebeat.yml`)
```yaml
filebeat.inputs:
- type: syslog
format: rfc3164
protocol.tcp:
host: "0.0.0.0:5140"
output.elasticsearch:
hosts: [ "http://victorialogs:9428/insert/elasticsearch/" ]
worker: 5
bulk_max_size: 1000
parameters:
_msg_field: "message"
_time_field: "@timestamp"
_stream_fields: "host.name,process.program,process.pid,container.name"
```
Please, note that `_stream_fields` parameter must follow recommended [best practices](https://docs.victoriametrics.com/victorialogs/keyconcepts/#stream-fields) to achieve better performance.

View file

@ -1,23 +0,0 @@
services:
filebeat-vlogs:
image: docker.elastic.co/beats/filebeat:8.8.1
user: root
command:
- "--strict.perms=false"
volumes:
- ./filebeat.yml:/usr/share/filebeat/filebeat.yml:ro
depends_on: [victorialogs]
ports:
- "5140:5140"
victorialogs:
image: docker.io/victoriametrics/victoria-logs:v0.29.0-victorialogs
volumes:
- victorialogs-filebeat-syslog-vl:/vlogs
ports:
- "9428:9428"
command:
- -storageDataPath=/vlogs
volumes:
victorialogs-filebeat-syslog-vl:

View file

@ -1,8 +1,11 @@
# Docker compose Filebeat integration with VictoriaLogs for docker
# Docker compose Filebeat integration with VictoriaLogs using listed below protocols:
* [syslog](./syslog)
* [elasticsearch](./elasticsearch)
The folder contains the example of integration of [filebeat](https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-overview.html) with Victorialogs
To spin-up environment run the following command:
To spin-up environment `cd` to any of listed above directories run the following command:
```
docker compose up -d
```
@ -16,39 +19,16 @@ docker compose rm -f
The docker compose file contains the following components:
* filebeat - fileabeat is configured to collect logs from the `docker`, you can find configuration in the `filebeat.yml`. It writes data in VictoriaLogs
* filebeat-exporter - it export metrics about the filebeat
* VictoriaLogs - the log database, it accepts the data from `filebeat` by elastic protocol
* VictoriaMetrics - collects metrics from `filebeat` via `filebeat-exporter`, `VictoriaLogs` and `VictoriaMetrics`
* grafana - it comes with two predefined dashboards for `VictoriaLogs` and `VictoriaMetrics`
Querying the data
* [vmui](https://docs.victoriametrics.com/victorialogs/querying/#vmui) - a web UI is accessible by `http://localhost:9428/select/vmui`
* for querying the data via command-line please check [these docs](https://docs.victoriametrics.com/victorialogs/querying/#command-line)
the example of filebeat configuration(`filebeat.yml`)
```yaml
filebeat.autodiscover:
providers:
- type: docker
hints.enabled: true
processors:
- add_docker_metadata: ~
output.elasticsearch:
hosts: [ "http://victorialogs:9428/insert/elasticsearch/" ]
worker: 5
parameters:
_msg_field: "message"
_time_field: "@timestamp"
_stream_fields: "container.name"
http:
enabled: true
host: 0.0.0.0
port: 5066
```
Filebeat configuration example can be found below:
- [syslog](./syslog/filebeat.yml)
- [elasticsearch](./elasticsearch/filebeat.yml)
Please, note that `_stream_fields` parameter must follow recommended [best practices](https://docs.victoriametrics.com/victorialogs/keyconcepts/#stream-fields) to achieve better performance.

View file

@ -1,6 +1,8 @@
include:
- ../compose.yml
services:
filebeat-victorialogs:
image: docker.elastic.co/beats/filebeat:8.8.1
image: docker.elastic.co/beats/filebeat:8.15.0
restart: on-failure
volumes:
- type: bind
@ -9,50 +11,8 @@ services:
- type: bind
source: /var/lib/docker/containers/
target: /var/lib/docker/containers/
- ./filebeat.yml:/usr/share/filebeat/filebeat.yml:ro
- ${PWD}/filebeat.yml:/usr/share/filebeat/filebeat.yml:ro
user: root
command:
- "--strict.perms=false"
depends_on: [victorialogs]
beat-exporter-victorialogs:
image: trustpilot/beat-exporter:0.4.0
command:
- -beat.uri=http://filebeat-victorialogs:5066
victorialogs:
image: docker.io/victoriametrics/victoria-logs:v0.29.0-victorialogs
volumes:
- victorialogs-filebeat-docker-vl:/vlogs
ports:
- '9428:9428'
command:
- -storageDataPath=/vlogs
- -loggerFormat=json
grafana:
container_name: grafana
image: grafana/grafana:9.2.7
depends_on:
- "victoriametrics"
ports:
- 3000:3000
volumes:
- victorialogs-filebeat-docker-grafana:/var/lib/grafana
- ./../../provisioning/:/etc/grafana/provisioning/
- ./../../../../dashboards/victoriametrics.json:/var/lib/grafana/dashboards/vm.json
- ./../../../../dashboards/victorialogs.json:/var/lib/grafana/dashboards/vl.json
victoriametrics:
image: victoriametrics/victoria-metrics:latest
ports:
- '8428:8428'
command:
- -storageDataPath=/vmsingle
- -promscrape.config=/promscrape.yml
- -loggerFormat=json
volumes:
- victorialogs-filebeat-docker-vm:/vmsingle
- ./scrape.yml:/promscrape.yml
volumes:
victorialogs-filebeat-docker-vl:
victorialogs-filebeat-docker-vm:
victorialogs-filebeat-docker-grafana:

View file

@ -0,0 +1,3 @@
include:
- ../compose.yml
name: filebeat-elasticsearch

View file

@ -1,16 +0,0 @@
scrape_configs:
- job_name: "filebeat"
scrape_interval: 30s
static_configs:
- targets:
- beat-exporter-victorialogs:9479
- job_name: "victoriametrics"
scrape_interval: 30s
static_configs:
- targets:
- victoriametrics:8428
- job_name: "victorialogs"
scrape_interval: 30s
static_configs:
- targets:
- victorialogs:9428

View file

@ -0,0 +1,3 @@
include:
- ../compose.yml
name: filebeat-syslog

View file

@ -1,88 +0,0 @@
# Docker compose Fluentbit integration with VictoriaLogs for docker. High-Availability example
The folder contains the example of integration of [fluentbit](https://docs.fluentbit.io/manual) with VictoriaLogs Single-Nodes(s) and [vmauth](https://docs.victoriametrics.com/vmauth/) for achieving High Availability.
Check [this documentation](https://docs.victoriametrics.com/victorialogs/#high-availability) with a description of the architecture and components.
To spin-up environment run the following command:
```shell
docker compose up -d
```
To shut down the docker-compose environment run the following command:
```shell
docker compose down
docker compose rm -f
```
The docker compose file contains the following components:
* fluentbit - fluentbit is configured to collect logs from the `docker`, you can find configuration in the `fluent-bit.conf`. It writes data in VictoriaLogs
* VictoriaLogs - the two instances of log database, they accept the data from `fluentbit` by json line protocol
* vmauth - load balancer for proxying requests to one of VictoriaLogs
Querying the data
* [vmui](https://docs.victoriametrics.com/victorialogs/querying/#vmui) - a web UI is accessible by `http://localhost:8427/select/vmui/`
* for querying the data via command-line please check [these docs](https://docs.victoriametrics.com/victorialogs/querying/#command-line)
the example of fluentbit configuration(`fluent-bit.conf`)
```text
[INPUT]
name tail
path /var/lib/docker/containers/**/*.log
path_key path
multiline.parser docker, cri
Parser docker
Docker_Mode On
[INPUT]
Name syslog
Listen 0.0.0.0
Port 5140
Parser syslog-rfc3164
Mode tcp
[SERVICE]
Flush 1
Parsers_File parsers.conf
[OUTPUT]
Name http
Match *
host victorialogs-2
port 9428
compress gzip
uri /insert/jsonline?_stream_fields=stream,path&_msg_field=log&_time_field=date
format json_lines
json_date_format iso8601
header AccountID 0
header ProjectID 0
[OUTPUT]
Name http
Match *
host victorialogs-1
port 9428
compress gzip
uri /insert/jsonline?_stream_fields=stream,path&_msg_field=log&_time_field=date
format json_lines
json_date_format iso8601
header AccountID 0
header ProjectID 0
```
Please, note that `_stream_fields` parameter must follow recommended [best practices](https://docs.victoriametrics.com/victorialogs/keyconcepts/#stream-fields) to achieve better performance.
The example of vmauth configuration (`auth.yml`)
```yaml
unauthorized_user:
url_prefix:
- http://victorialogs-1:9428
- http://victorialogs-2:9428
```

View file

@ -1,6 +0,0 @@
# balance load among victorialogs instances
# see https://docs.victoriametrics.com/vmauth/#load-balancing
unauthorized_user:
url_prefix:
- http://victorialogs-1:9428
- http://victorialogs-2:9428

View file

@ -1,38 +0,0 @@
services:
fluentbit:
image: cr.fluentbit.io/fluent/fluent-bit:3.0.7
volumes:
- /var/lib/docker/containers:/var/lib/docker/containers:ro
- ./fluent-bit.conf:/fluent-bit/etc/fluent-bit.conf
depends_on: [victorialogs-1,victorialogs-2]
ports:
- "5140:5140"
victorialogs-1:
image: docker.io/victoriametrics/victoria-logs:v0.29.0-victorialogs
volumes:
- victorialogs-fluentbit-vl-ha-single-1:/vlogs
command:
- -storageDataPath=/vlogs
victorialogs-2:
image: docker.io/victoriametrics/victoria-logs:v0.29.0-victorialogs
volumes:
- victorialogs-fluentbit-vl-ha-single-2:/vlogs
command:
- -storageDataPath=/vlogs
vmauth:
container_name: vmauth
image: victoriametrics/vmauth:v1.103.0
depends_on:
- "victorialogs-1"
- "victorialogs-2"
volumes:
- ./auth.yml:/etc/auth.yml
command:
- '--auth.config=/etc/auth.yml'
ports:
- 8427:8427
restart: always
volumes:
victorialogs-fluentbit-vl-ha-single-1:
victorialogs-fluentbit-vl-ha-single-2:

View file

@ -1,8 +1,12 @@
# Docker compose Fluentbit integration with VictoriaLogs for docker
# Docker compose Fluentbit integration with VictoriaLogs using given below protocols:
* [loki](./loki)
* [jsonline single node](./jsonline)
* [jsonline HA setup](./jsonline-ha)
The folder contains the example of integration of [fluentbit](https://docs.fluentbit.io/manual) with Victorialogs
To spin-up environment run the following command:
To spin-up environment `cd` to any of listed above directories run the following command:
```
docker compose up -d
```
@ -23,39 +27,9 @@ Querying the data
* [vmui](https://docs.victoriametrics.com/victorialogs/querying/#vmui) - a web UI is accessible by `http://localhost:9428/select/vmui`
* for querying the data via command-line please check [these docs](https://docs.victoriametrics.com/victorialogs/querying/#command-line)
the example of fluentbit configuration(`fluent-bit.conf`)
```shell
[INPUT]
name tail
path /var/lib/docker/containers/**/*.log
multiline.parser docker, cri
Parser docker
Docker_Mode On
[INPUT]
Name syslog
Listen 0.0.0.0
Port 5140
Parser syslog-rfc3164
Mode tcp
[SERVICE]
Flush 1
Parsers_File parsers.conf
[Output]
Name http
Match *
host victorialogs
port 9428
compress gzip
uri /insert/jsonline?_stream_fields=stream&_msg_field=log&_time_field=date
format json_lines
json_date_format iso8601
header AccountID 0
header ProjectID 0
```
FluentBit configuration example can be found below:
* [loki](./loki/fluent-bit.conf)
* [jsonline single node](./jsonline/fluent-bit.conf)
* [jsonline HA setup](./jsonline-ha/fluent-bit.conf)
Please, note that `_stream_fields` parameter must follow recommended [best practices](https://docs.victoriametrics.com/victorialogs/keyconcepts/#stream-fields) to achieve better performance.

View file

@ -1,21 +1,11 @@
include:
- ../compose.yml
services:
fluentbit:
image: cr.fluentbit.io/fluent/fluent-bit:3.0.7
image: cr.fluentbit.io/fluent/fluent-bit:3.1.7
volumes:
- /var/lib/docker/containers:/var/lib/docker/containers:ro
- ./fluent-bit.conf:/fluent-bit/etc/fluent-bit.conf
- ${PWD}/fluent-bit.conf:/fluent-bit/etc/fluent-bit.conf
depends_on: [victorialogs]
ports:
- "5140:5140"
victorialogs:
image: docker.io/victoriametrics/victoria-logs:v0.29.0-victorialogs
volumes:
- victorialogs-fluentbit-vl:/vlogs
ports:
- "9428:9428"
command:
- -storageDataPath=/vlogs
volumes:
victorialogs-fluentbit-vl:

View file

@ -0,0 +1,5 @@
include:
- path:
- ../compose.yml
- ../../compose-ha.yml
name: fluentbit-jsonline-ha

View file

@ -17,7 +17,19 @@
Flush 1
Parsers_File parsers.conf
[OUTPUT]
[Output]
Name http
Match *
host victorialogs
port 9428
compress gzip
uri /insert/jsonline?_stream_fields=stream,path&_msg_field=log&_time_field=date
format json_lines
json_date_format iso8601
header AccountID 0
header ProjectID 0
[Output]
Name http
Match *
host victorialogs-2
@ -28,15 +40,3 @@
json_date_format iso8601
header AccountID 0
header ProjectID 0
[OUTPUT]
Name http
Match *
host victorialogs-1
port 9428
compress gzip
uri /insert/jsonline?_stream_fields=stream,path&_msg_field=log&_time_field=date
format json_lines
json_date_format iso8601
header AccountID 0
header ProjectID 0

View file

@ -0,0 +1,3 @@
include:
- ../compose.yml
name: fluentbit-jsonline

View file

@ -0,0 +1,30 @@
[INPUT]
name tail
path /var/lib/docker/containers/**/*.log
path_key path
multiline.parser docker, cri
Parser docker
Docker_Mode On
[INPUT]
Name syslog
Listen 0.0.0.0
Port 5140
Parser syslog-rfc3164
Mode tcp
[SERVICE]
Flush 1
Parsers_File parsers.conf
[Output]
Name http
Match *
host victorialogs
port 9428
compress gzip
uri /insert/jsonline?_stream_fields=stream,path&_msg_field=log&_time_field=date
format json_lines
json_date_format iso8601
header AccountID 0
header ProjectID 0

View file

@ -0,0 +1,3 @@
include:
- ../compose.yml
name: fluentbit-loki

View file

@ -17,31 +17,6 @@
Flush 1
Parsers_File parsers.conf
[OUTPUT]
Name http
Match *
host victorialogs
port 9428
compress gzip
uri /insert/jsonline?_stream_fields=stream,path&_msg_field=log&_time_field=date
format json_lines
json_date_format iso8601
header AccountID 0
header ProjectID 0
[OUTPUT]
Name es
Match *
host victorialogs
port 9428
compress gzip
path /insert/elasticsearch
header AccountID 0
header ProjectID 0
header VL-Stream-Fields path
header VL-Msg-Field log
header VL-Time-Field @timestamp
[OUTPUT]
name loki
match *

View file

@ -0,0 +1,8 @@
FROM fluent/fluentd:v1.17
USER root
RUN \
gem install \
fluent-plugin-datadog \
fluent-plugin-grafana-loki \
fluent-plugin-elasticsearch
USER fluent

View file

@ -0,0 +1,35 @@
# Docker compose Fluentd integration with VictoriaLogs using given below protocols:
* [loki](./loki)
* [jsonline](./jsonline)
* [elasticsearch](./elasticsearch)
The folder contains the example of integration of [fluentd](https://www.fluentd.org/) with Victorialogs
To spin-up environment `cd` to any of listed above directories run the following command:
```
docker compose up -d
```
To shut down the docker-compose environment run the following command:
```
docker compose down
docker compose rm -f
```
The docker compose file contains the following components:
* fluentd - fluentd is configured to collect logs from the `docker`, you can find configuration in the `fluent-bit.conf`. It writes data in VictoriaLogs
* VictoriaLogs - the log database, it accepts the data from `fluentd` by json line protocol
Querying the data
* [vmui](https://docs.victoriametrics.com/victorialogs/querying/#vmui) - a web UI is accessible by `http://localhost:9428/select/vmui`
* for querying the data via command-line please check [these docs](https://docs.victoriametrics.com/victorialogs/querying/#command-line)
Fluentd configuration example can be found below:
* [loki](./loki/fluent.conf)
* [jsonline](./jsonline/fluent.conf)
* [elasticsearch](./elasticsearch/fluent.conf)
Please, note that `_stream_fields` parameter must follow recommended [best practices](https://docs.victoriametrics.com/victorialogs/keyconcepts/#stream-fields) to achieve better performance.

View file

@ -0,0 +1,11 @@
include:
- ../compose.yml
services:
fluentd:
build: .
volumes:
- /var/lib/docker/containers:/var/lib/docker/containers:ro
- ${PWD}/fluent.conf:/fluentd/etc/fluent.conf
depends_on: [victorialogs]
ports:
- "5140:5140"

View file

@ -0,0 +1,3 @@
include:
- ../compose.yml
name: fluentd-elasticsearch

View file

@ -0,0 +1,13 @@
<source>
@type tail
format none
tag docker.testlog
path /var/lib/docker/containers/**/*.log
</source>
<match **>
@type elasticsearch
host victorialogs
path /insert/elasticsearch
port 9428
</match>

View file

@ -0,0 +1,3 @@
include:
- ../compose.yml
name: fluentd-jsonline

View file

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

View file

@ -0,0 +1,3 @@
include:
- ../compose.yml
name: fluentbit-loki

View file

@ -0,0 +1,17 @@
<source>
@type tail
format none
tag docker.testlog
path /var/lib/docker/containers/**/*.log
</source>
<match **>
@type loki
url "http://victorialogs:9428/insert"
<buffer>
flush_interval 10s
flush_at_shutdown true
</buffer>
custom_headers {"VL-Msg-Field": "log", "VL-Time-Field": "time", "VL-Stream-Fields": "path"}
buffer_chunk_limit 1m
</match>

View file

@ -1,71 +0,0 @@
# Docker compose Logstash integration with VictoriaLogs for docker. High-Availability example
The folder contains the example of integration of [logstash](https://www.elastic.co/logstash) with VictoriaLogs Single-Node(s) and [vmauth](https://docs.victoriametrics.com/vmauth/) for achieving High Availability.
Check [this documentation](https://docs.victoriametrics.com/victorialogs/#high-availability) with a description of the architecture and components.
To spin-up environment run the following command:
```shell
docker compose up -d
```
To shut down the docker-compose environment run the following command:
```shell
docker compose down
docker compose rm -f
```
The docker compose file contains the following components:
* logstash - logstash is configured to read docker log files, you can find configuration in the `pipeline.conf`. It writes data in two instances of VictoriaLogs
* VictoriaLogs - the two instances of log database, they accept the data from `fluentbit` by json line protocol
* vmauth - load balancer for proxying requests to one of VictoriaLogs
Querying the data
* [vmui](https://docs.victoriametrics.com/victorialogs/querying/#vmui) - a web UI is accessible by `http://localhost:8427/select/vmui/`
* for querying the data via command-line please check [these docs](https://docs.victoriametrics.com/victorialogs/querying/#command-line)
Here is an example of logstash configuration(`pipeline.conf`):
```text
input {
file {
path => "/var/lib/docker/containers/*/*.log"
start_position => "beginning"
type => "docker"
sincedb_path => "/dev/null"
codec => "json"
add_field => {
"path" => "%{[@metadata][path]}"
}
}
}
output {
http {
url => "http://victorialogs-1:9428/insert/jsonline?_stream_fields=host.name,stream&_msg_field=log&_time_field=time"
format => "json"
http_method => "post"
}
http {
url => "http://victorialogs-2:9428/insert/jsonline?_stream_fields=host.name,stream&_msg_field=log&_time_field=time"
format => "json"
http_method => "post"
}
}
```
Please, note that `_stream_fields` parameter must follow recommended [best practices](https://docs.victoriametrics.com/victorialogs/keyconcepts/#stream-fields) to achieve better performance.
The example of vmauth configuration (`auth.yml`)
```yaml
unauthorized_user:
url_prefix:
- http://victorialogs-1:9428
- http://victorialogs-2:9428
```

View file

@ -1,6 +0,0 @@
# balance load among victorialogs instances
# see https://docs.victoriametrics.com/vmauth/#load-balancing
unauthorized_user:
url_prefix:
- http://victorialogs-1:9428
- http://victorialogs-2:9428

View file

@ -1,41 +0,0 @@
services:
logstash:
image: docker.elastic.co/logstash/logstash:8.8.1
user: root
volumes:
- ./pipeline.conf:/usr/share/logstash/pipeline/logstash.conf:ro
- ./logstash.yml:/usr/share/logstash/config/logstash.yml:ro
- /var/lib/docker/containers:/var/lib/docker/containers:ro
depends_on: [victorialogs-1,victorialogs-2]
ports:
- "5140:5140"
victorialogs-1:
image: docker.io/victoriametrics/victoria-logs:v0.29.0-victorialogs
volumes:
- victorialogs-logstash-vl-ha-single-1:/vlogs
command:
- -storageDataPath=/vlogs
victorialogs-2:
image: docker.io/victoriametrics/victoria-logs:v0.29.0-victorialogs
volumes:
- victorialogs-logstash-vl-ha-single-2:/vlogs
command:
- -storageDataPath=/vlogs
vmauth:
container_name: vmauth
image: victoriametrics/vmauth:v1.103.0
depends_on:
- "victorialogs-1"
- "victorialogs-2"
volumes:
- ./auth.yml:/etc/auth.yml
command:
- '--auth.config=/etc/auth.yml'
ports:
- 8427:8427
restart: always
volumes:
victorialogs-logstash-vl-ha-single-1:
victorialogs-logstash-vl-ha-single-2:

View file

@ -1,2 +0,0 @@
http.host: 0.0.0.0
xpack.monitoring.enabled: false

View file

@ -1,4 +1,4 @@
FROM docker.elastic.co/logstash/logstash:8.8.1
FROM docker.elastic.co/logstash/logstash:8.15.0
RUN bin/logstash-plugin install \
logstash-output-opensearch \

View file

@ -1,4 +1,9 @@
# Docker compose Logstash integration with VictoriaLogs for syslog
# Docker compose Logstash integration with VictoriaLogs for given below protocols:
* [loki](./loki)
* [jsonline single node](./jsonline)
* [jsonline HA setup](./jsonline-ha)
* [elasticsearch](./elasticsearch)
It is required to use [OpenSearch plugin](https://github.com/opensearch-project/logstash-output-opensearch) for output configuration.
Plugin can be installed by using the following command:
@ -7,7 +12,7 @@ bin/logstash-plugin install logstash-output-opensearch
```
OpenSearch plugin is required because elasticsearch output plugin performs various checks for Elasticsearch version and license which are not applicable for VictoriaLogs.
To spin-up environment run the following command:
To spin-up environment `cd` to any of listed above directories run the following command:
```
docker compose up -d
```
@ -28,29 +33,10 @@ Querying the data
* [vmui](https://docs.victoriametrics.com/victorialogs/querying/#vmui) - a web UI is accessible by `http://localhost:9428/select/vmui`
* for querying the data via command-line please check [these docs](https://docs.victoriametrics.com/victorialogs/querying/#command-line)
Here is an example of logstash configuration(`pipeline.conf`):
```
input {
syslog {
port => 5140
}
}
output {
opensearch {
hosts => ["http://victorialogs:9428/insert/elasticsearch"]
custom_headers => {
"AccountID" => "0"
"ProjectID" => "0"
}
parameters => {
"_stream_fields" => "host.ip,process.name"
"_msg_field" => "message"
"_time_field" => "@timestamp"
}
}
}
```
Logstash configuration example can be found below:
* [loki](./loki/pipeline.conf)
* [jsonline single node](./jsonline/pipeline.conf)
* [jsonline HA setup](./jsonline-ha/pipeline.conf)
* [elasticsearch](./elasticsearch/pipeline.conf)
Please, note that `_stream_fields` parameter must follow recommended [best practices](https://docs.victoriametrics.com/victorialogs/keyconcepts/#stream-fields) to achieve better performance.

View file

@ -1,24 +1,15 @@
include:
- ../compose.yml
services:
logstash:
build:
context: .
dockerfile: Dockerfile
user: root
restart: on-failure
volumes:
- ./pipeline.conf:/usr/share/logstash/pipeline/logstash.conf:ro
- /var/lib/docker/containers:/var/lib/docker/containers
- ${PWD}/pipeline.conf:/usr/share/logstash/pipeline/logstash.conf:ro
- ./logstash.yml:/usr/share/logstash/config/logstash.yml:ro
depends_on: [victorialogs]
ports:
- "5140:5140"
victorialogs:
image: docker.io/victoriametrics/victoria-logs:v0.29.0-victorialogs
volumes:
- victorialogs-logstash-vl:/vlogs
ports:
- "9428:9428"
command:
- -storageDataPath=/vlogs
volumes:
victorialogs-logstash-vl:

View file

@ -0,0 +1,3 @@
include:
- ../compose.yml
name: logstash-elasticsearch

View file

@ -17,12 +17,4 @@ output {
"_time_field" => "@timestamp"
}
}
http {
url => "http://victorialogs:9428/insert/jsonline?_stream_fields=host.ip,process.name&_msg_field=message&_time_field=@timestamp"
format => "json"
http_method => "post"
}
loki {
url => "http://victorialogs:9428/insert/loki/api/v1/push?_stream_fields=host.ip,process.name&_msg_field=message&_time_field=@timestamp"
}
}

View file

@ -0,0 +1,5 @@
include:
- path:
- ../compose.yml
- ../../compose-ha.yml
name: logstash-jsonline-ha

View file

@ -13,7 +13,7 @@ input {
output {
http {
url => "http://victorialogs-1:9428/insert/jsonline?_stream_fields=host.name,stream&_msg_field=log&_time_field=time"
url => "http://victorialogs:9428/insert/jsonline?_stream_fields=host.name,stream&_msg_field=log&_time_field=time"
format => "json"
http_method => "post"
}

View file

@ -0,0 +1,3 @@
include:
- ../compose.yml
name: logstash-jsonline

View file

@ -0,0 +1,13 @@
input {
syslog {
port => 5140
}
}
output {
http {
url => "http://victorialogs:9428/insert/jsonline?_stream_fields=host.ip,process.name&_msg_field=message&_time_field=@timestamp"
format => "json"
http_method => "post"
}
}

View file

@ -0,0 +1,3 @@
include:
- ../compose.yml
name: logstash-loki

View file

@ -0,0 +1,11 @@
input {
syslog {
port => 5140
}
}
output {
loki {
url => "http://victorialogs:9428/insert/loki/api/v1/push?_stream_fields=host.ip,process.name&_msg_field=message&_time_field=@timestamp"
}
}

View file

@ -1,8 +1,14 @@
# Docker compose OpenTelemetry Elasticsearch integration with VictoriaLogs for docker
# Docker compose OpenTelemetry integration with VictoriaLogs using protocols:
* [loki](./loki)
* [otlp](./otlp)
* [syslog](./syslog)
* [elasticsearch single node](./elasticsearch)
* [elasticsearch HA mode](./elasticsearch-ha/)
The folder contains the example of integration of [OpenTelemetry collector](https://opentelemetry.io/docs/collector/) with Victorialogs
To spin-up environment run the following command:
To spin-up environment `cd` to any of listed above directories run the following command:
```
docker compose up -d
```
@ -24,4 +30,11 @@ Querying the data
* [vmui](https://docs.victoriametrics.com/victorialogs/querying/#vmui) - a web UI is accessible by `http://localhost:9428/select/vmui`
* for querying the data via command-line please check [these docs](https://docs.victoriametrics.com/victorialogs/querying/#command-line)
OpenTelemetry collector configuration example can be found below:
* [loki](./loki/config.yaml)
* [otlp](./otlp/config.yaml)
* [syslog](./syslog/config.yaml)
* [elasticsearch single node](./elasticsearch/config.yaml)
* [elasticsearch HA mode](./elasticsearch-ha/config.yaml)
Please, note that `_stream_fields` parameter must follow recommended [best practices](https://docs.victoriametrics.com/victorialogs/keyconcepts/#stream-fields) to achieve better performance.

View file

@ -0,0 +1,15 @@
include:
- ../compose.yml
services:
collector:
image: docker.io/otel/opentelemetry-collector-contrib:0.108.0
restart: on-failure
user: 0:0
volumes:
- ${PWD}/config.yaml:/etc/otelcol-contrib/config.yaml
- /var/lib/docker/containers:/var/lib/docker/containers
depends_on:
victorialogs:
condition: service_healthy
victoriametrics:
condition: service_healthy

View file

@ -0,0 +1,5 @@
include:
- path:
- ../compose.yml
- ../../compose-ha.yml
name: collector-elasticsearch-ha

View file

@ -0,0 +1,15 @@
exporters:
elasticsearch:
endpoints:
- http://victorialogs:9428/insert/elasticsearch
- http://victorialogs-2:9428/insert/elasticsearch
receivers:
filelog:
include: [/var/lib/docker/containers/**/*.log]
resource:
region: us-east-1
service:
pipelines:
logs:
receivers: [filelog]
exporters: [elasticsearch]

View file

@ -1,48 +1,3 @@
services:
collector:
image: docker.io/otel/opentelemetry-collector-contrib:0.102.1
restart: on-failure
volumes:
- $PWD/logs:/tmp/logs
- $PWD/config.yaml:/etc/otelcol-contrib/config.yaml
depends_on:
victorialogs:
condition: service_healthy
victoriametrics:
condition: service_healthy
victorialogs:
image: docker.io/victoriametrics/victoria-logs:v0.29.0-victorialogs
volumes:
- victorialogs-vector-docker-vl:/vlogs
ports:
- '9428:9428'
command:
- -storageDataPath=/vlogs
- -loggerFormat=json
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:9428/health"]
interval: 1s
timeout: 1s
retries: 10
victoriametrics:
image: victoriametrics/victoria-metrics:latest
ports:
- '8428:8428'
command:
- -storageDataPath=/vmsingle
- -promscrape.config=/promscrape.yml
- -loggerFormat=json
volumes:
- victorialogs-vector-docker-vm:/vmsingle
- ./scrape.yml:/promscrape.yml
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:8428/health"]
interval: 1s
timeout: 1s
retries: 10
volumes:
victorialogs-vector-docker-vl:
victorialogs-vector-docker-vm:
include:
- ../compose.yml
name: collector-elasticsearch

View file

@ -4,7 +4,7 @@ exporters:
- http://victorialogs:9428/insert/elasticsearch
receivers:
filelog:
include: [/tmp/logs/*.log]
include: [/var/lib/docker/containers/**/*.log]
resource:
region: us-east-1
service:

View file

@ -1,11 +0,0 @@
scrape_configs:
- job_name: "victoriametrics"
scrape_interval: 30s
static_configs:
- targets:
- victoriametrics:8428
- job_name: "victorialogs"
scrape_interval: 30s
static_configs:
- targets:
- victorialogs:9428

View file

@ -1,27 +0,0 @@
# Docker compose OpenTelemetry Loki integration with VictoriaLogs for docker
The folder contains the example of integration of [OpenTelemetry collector](https://opentelemetry.io/docs/collector/) with Victorialogs
To spin-up environment run the following command:
```
docker compose up -d
```
To shut down the docker-compose environment run the following command:
```
docker compose down
docker compose rm -f
```
The docker compose file contains the following components:
* collector - vector is configured to collect logs from the `docker`, you can find configuration in the `config.yaml`. It writes data in VictoriaLogs. It pushes metrics to VictoriaMetrics.
* VictoriaLogs - the log database, it accepts the data from `collector` by Loki protocol
* VictoriaMetrics - collects metrics from `VictoriaLogs` and `VictoriaMetrics`
Querying the data
* [vmui](https://docs.victoriametrics.com/victorialogs/querying/#vmui) - a web UI is accessible by `http://localhost:9428/select/vmui`
* for querying the data via command-line please check [these docs](https://docs.victoriametrics.com/victorialogs/querying/#command-line)
Please, note that `_stream_fields` parameter must follow recommended [best practices](https://docs.victoriametrics.com/victorialogs/keyconcepts/#stream-fields) to achieve better performance.

View file

@ -1,48 +1,3 @@
services:
collector:
image: docker.io/otel/opentelemetry-collector-contrib:0.102.1
restart: on-failure
volumes:
- $PWD/logs:/tmp/logs
- $PWD/config.yaml:/etc/otelcol-contrib/config.yaml
depends_on:
victorialogs:
condition: service_healthy
victoriametrics:
condition: service_healthy
victorialogs:
image: docker.io/victoriametrics/victoria-logs:v0.29.0-victorialogs
volumes:
- victorialogs-vector-docker-vl:/loki
ports:
- '9428:9428'
command:
- -storageDataPath=/loki
- -loggerFormat=json
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:9428/health"]
interval: 1s
timeout: 1s
retries: 10
victoriametrics:
image: victoriametrics/victoria-metrics:latest
ports:
- '8428:8428'
command:
- -storageDataPath=/vmsingle
- -promscrape.config=/promscrape.yml
- -loggerFormat=json
volumes:
- victorialogs-vector-docker-vm:/vmsingle
- ./scrape.yml:/promscrape.yml
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:8428/health"]
interval: 1s
timeout: 1s
retries: 10
volumes:
victorialogs-vector-docker-vl:
victorialogs-vector-docker-vm:
include:
- ../compose.yml
name: collector-loki

View file

@ -3,7 +3,7 @@ exporters:
endpoint: http://victorialogs:9428/insert/loki/api/v1/push
receivers:
filelog:
include: [/tmp/logs/*.log]
include: [/var/lib/docker/containers/**/*.log]
resource:
region: us-east-1
service:

View file

@ -1,11 +0,0 @@
scrape_configs:
- job_name: "victoriametrics"
scrape_interval: 30s
static_configs:
- targets:
- victoriametrics:8428
- job_name: "victorialogs"
scrape_interval: 30s
static_configs:
- targets:
- victorialogs:9428

View file

@ -1,27 +0,0 @@
# Docker compose OpenTelemetry OTLP integration with VictoriaLogs for docker
The folder contains the example of integration of [OpenTelemetry collector](https://opentelemetry.io/docs/collector/) with Victorialogs
To spin-up environment run the following command:
```
docker compose up -d
```
To shut down the docker-compose environment run the following command:
```
docker compose down
docker compose rm -f
```
The docker compose file contains the following components:
* collector - vector is configured to collect logs from the `docker`, you can find configuration in the `config.yaml`. It writes data in VictoriaLogs. It pushes metrics to VictoriaMetrics.
* VictoriaLogs - the log database, it accepts the data from `collector` by otlp protocol
* VictoriaMetrics - collects metrics from `VictoriaLogs` and `VictoriaMetrics`
Querying the data
* [vmui](https://docs.victoriametrics.com/victorialogs/querying/#vmui) - a web UI is accessible by `http://localhost:9428/select/vmui`
* for querying the data via command-line please check [these docs](https://docs.victoriametrics.com/victorialogs/querying/#command-line)
Please, note that `_stream_fields` parameter must follow recommended [best practices](https://docs.victoriametrics.com/victorialogs/keyconcepts/#stream-fields) to achieve better performance.

View file

@ -1,48 +1,3 @@
services:
collector:
image: docker.io/otel/opentelemetry-collector-contrib:0.102.1
restart: on-failure
volumes:
- $PWD/logs:/tmp/logs
- $PWD/config.yaml:/etc/otelcol-contrib/config.yaml
depends_on:
victorialogs:
condition: service_healthy
victoriametrics:
condition: service_healthy
victorialogs:
image: docker.io/victoriametrics/victoria-logs:v0.29.0-victorialogs
volumes:
- victorialogs-vector-docker-vl:/otlp
ports:
- '9428:9428'
command:
- -storageDataPath=/otlp
- -loggerFormat=json
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:9428/health"]
interval: 1s
timeout: 1s
retries: 10
victoriametrics:
image: victoriametrics/victoria-metrics:latest
ports:
- '8428:8428'
command:
- -storageDataPath=/vmsingle
- -promscrape.config=/promscrape.yml
- -loggerFormat=json
volumes:
- victorialogs-vector-docker-vm:/vmsingle
- ./scrape.yml:/promscrape.yml
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:8428/health"]
interval: 1s
timeout: 1s
retries: 10
volumes:
victorialogs-vector-docker-vl:
victorialogs-vector-docker-vm:
include:
- ../compose.yml
name: collector-otlp

View file

@ -5,7 +5,7 @@ exporters:
verbosity: detailed
receivers:
filelog:
include: [/tmp/logs/*.log]
include: [/var/lib/docker/containers/**/*.log]
resource:
region: us-east-1
service:

View file

@ -1,11 +0,0 @@
scrape_configs:
- job_name: "victoriametrics"
scrape_interval: 30s
static_configs:
- targets:
- victoriametrics:8428
- job_name: "victorialogs"
scrape_interval: 30s
static_configs:
- targets:
- victorialogs:9428

View file

@ -1,27 +0,0 @@
# Docker compose OpenTelemetry Syslog integration with VictoriaLogs for docker
The folder contains the example of integration of [OpenTelemetry collector](https://opentelemetry.io/docs/collector/) with Victorialogs
To spin-up environment run the following command:
```
docker compose up -d
```
To shut down the docker-compose environment run the following command:
```
docker compose down
docker compose rm -f
```
The docker compose file contains the following components:
* collector - vector is configured to collect logs from the `docker`, you can find configuration in the `config.yaml`. It writes data in VictoriaLogs. It pushes metrics to VictoriaMetrics.
* VictoriaLogs - the log database, it accepts the data from `collector` by syslog protocol
* VictoriaMetrics - collects metrics from `VictoriaLogs` and `VictoriaMetrics`
Querying the data
* [vmui](https://docs.victoriametrics.com/victorialogs/querying/#vmui) - a web UI is accessible by `http://localhost:9428/select/vmui`
* for querying the data via command-line please check [these docs](https://docs.victoriametrics.com/victorialogs/querying/#command-line)
Please, note that `_stream_fields` parameter must follow recommended [best practices](https://docs.victoriametrics.com/victorialogs/keyconcepts/#stream-fields) to achieve better performance.

View file

@ -1,49 +1,3 @@
services:
collector:
image: docker.io/otel/opentelemetry-collector-contrib:0.107.0
restart: on-failure
volumes:
- $PWD/logs:/tmp/logs
- $PWD/config.yaml:/etc/otelcol-contrib/config.yaml
depends_on:
victorialogs:
condition: service_healthy
victoriametrics:
condition: service_healthy
victorialogs:
image: docker.io/victoriametrics/victoria-logs:v0.29.0-victorialogs
volumes:
- victorialogs-vector-docker-vl:/syslog
ports:
- '9428:9428'
command:
- -storageDataPath=/syslog
- -syslog.listenAddr.tcp=:5410
- -syslog.useLocalTimestamp.tcp
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:9428/health"]
interval: 1s
timeout: 1s
retries: 10
victoriametrics:
image: victoriametrics/victoria-metrics:latest
ports:
- '8428:8428'
command:
- -storageDataPath=/vmsingle
- -promscrape.config=/promscrape.yml
- -loggerFormat=json
volumes:
- victorialogs-vector-docker-vm:/vmsingle
- ./scrape.yml:/promscrape.yml
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:8428/health"]
interval: 1s
timeout: 1s
retries: 10
volumes:
victorialogs-vector-docker-vl:
victorialogs-vector-docker-vm:
include:
- ../compose.yml
name: collector-syslog

View file

@ -1,11 +0,0 @@
scrape_configs:
- job_name: "victoriametrics"
scrape_interval: 30s
static_configs:
- targets:
- victoriametrics:8428
- job_name: "victorialogs"
scrape_interval: 30s
static_configs:
- targets:
- victorialogs:9428

View file

@ -1,22 +1,12 @@
include:
- ../compose.yml
services:
promtail:
image: grafana/promtail:2.8.2
image: grafana/promtail:3.0.1
volumes:
- /var/lib/docker/containers:/var/lib/docker/containers:ro
- /var/log:/var/log:ro
- ./config.yml:/etc/promtail/docker-config.yml:ro
- ${PWD}/config.yml:/etc/promtail/docker-config.yml:ro
command: -config.file=/etc/promtail/docker-config.yml
ports:
- "5140:5140"
vlogs:
image: docker.io/victoriametrics/victoria-logs:v0.29.0-victorialogs
volumes:
- victorialogs-promtail-docker:/vlogs
ports:
- '9428:9428'
command:
- -storageDataPath=/vlogs
volumes:
victorialogs-promtail-docker:

View file

@ -0,0 +1,3 @@
include:
- ../compose.yml
name: promtail-elasticsearch

View file

@ -6,7 +6,7 @@ positions:
filename: /tmp/positions.yaml
clients:
- url: http://vlogs:9428/insert/loki/api/v1/push?_stream_fields=instance,job,host,app
- url: http://victorialogs:9428/insert/loki/api/v1/push?_stream_fields=instance,job,host,app
tenant_id: "0:0"
scrape_configs:

View file

@ -1,11 +0,0 @@
scrape_configs:
- job_name: "victoriametrics"
scrape_interval: 30s
static_configs:
- targets:
- victoriametrics:8428
- job_name: "victorialogs"
scrape_interval: 30s
static_configs:
- targets:
- victorialogs:9428

View file

@ -1,8 +1,13 @@
# Docker compose Telegraf integration with VictoriaLogs for docker
The folder contains the example of integration of [telegraf](https://www.influxdata.com/time-series-platform/telegraf/) with VictoriaLogs
The folder contains the examples of integration of [telegraf](https://www.influxdata.com/time-series-platform/telegraf/) with VictoriaLogs using:
To spin-up environment run the following command:
* [elasticsearch](./elasticsearch)
* [loki](./loki)
* [jsonline](./jsonline)
* [syslog](./syslog)
To spin-up environment `cd` to any of listed above directories run the following command:
```
docker compose up -d
```
@ -23,3 +28,11 @@ Querying the data
* [vmui](https://docs.victoriametrics.com/victorialogs/querying/#vmui) - a web UI is accessible by `http://localhost:9428/select/vmui`
* for querying the data via command-line please check [these docs](https://docs.victoriametrics.com/victorialogs/querying/#command-line)
Telegraf configuration example can be found below:
* [elasticsearch](./elasticsearch/telegraf.conf)
* [loki](./loki/telegraf.conf)
* [jsonline](./jsonline/telegraf.conf)
* [syslog](./syslog/telegraf.conf)
Please, note that `_stream_fields` parameter must follow recommended [best practices](https://docs.victoriametrics.com/victorialogs/keyconcepts/#stream-fields) to achieve better performance.

View file

@ -0,0 +1,20 @@
include:
- ../compose.yml
services:
telegraf:
image: bitnami/telegraf:1.31.3
restart: on-failure
volumes:
- type: bind
source: /var/run/docker.sock
target: /var/run/docker.sock
- type: bind
source: /var/lib/docker
target: /var/lib/docker
- ${PWD}/telegraf.conf:/etc/telegraf/telegraf.conf:ro
command: --config /etc/telegraf/telegraf.conf
depends_on:
victorialogs:
condition: service_healthy
victoriametrics:
condition: service_healthy

View file

@ -0,0 +1,3 @@
include:
- ../compose.yml
name: telegraf-elasticsearch

View file

@ -16,23 +16,6 @@
[[inputs.cpu]]
[[outputs.http]]
url = "http://victorialogs:9428/insert/jsonline?_msg_field=fields.msg&_stream_fields=tags.log_source,tags.metric_type"
data_format = "json"
namepass = ["docker_log"]
use_batch_format = false
[[outputs.loki]]
domain = "http://victorialogs:9428"
endpoint = "/insert/loki/api/v1/push?_msg_field=docker_log.msg&_time_field=@timestamp&_stream_fields=log_source,metric_type"
namepass = ["docker_log"]
gzip_request = true
sanitize_label_names = true
[[outputs.syslog]]
address = "tcp://victorialogs:8094"
namepass = ["docker_log"]
[[outputs.elasticsearch]]
urls = ["http://victorialogs:9428/insert/elasticsearch"]
timeout = "1m"

View file

@ -0,0 +1,3 @@
include:
- ../compose.yml
name: telegraf-jsonline

View file

@ -0,0 +1,43 @@
[agent]
interval = "10s"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 100000
collection_jitter = "0s"
flush_interval = "10s"
flush_jitter = "0s"
precision = ""
debug = false
quiet = false
logtarget = "file"
logfile = "/dev/null"
hostname = "pop-os"
omit_hostname = false
[[inputs.cpu]]
[[outputs.http]]
url = "http://victorialogs:9428/insert/jsonline?_msg_field=fields.msg&_stream_fields=tags.log_source,tags.metric_type"
data_format = "json"
namepass = ["docker_log"]
use_batch_format = false
[[outputs.http]]
url = "http://victoriametrics:8428/api/v1/write"
data_format = "prometheusremotewrite"
namepass = ["cpu"]
[outputs.http.headers]
Content-Type = "application/x-protobuf"
Content-Encoding = "snappy"
X-Prometheus-Remote-Write-Version = "0.1.0"
[[inputs.docker_log]]
[inputs.docker_log.tags]
metric_type = "logs"
log_source = "telegraf"
[[processors.rename]]
namepass = ["docker_log"]
[[processors.rename.replace]]
field = "message"
dest = "msg"

View file

@ -0,0 +1,3 @@
include:
- ../compose.yml
name: telegraf-loki

View file

@ -0,0 +1,44 @@
[agent]
interval = "10s"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 100000
collection_jitter = "0s"
flush_interval = "10s"
flush_jitter = "0s"
precision = ""
debug = false
quiet = false
logtarget = "file"
logfile = "/dev/null"
hostname = "pop-os"
omit_hostname = false
[[inputs.cpu]]
[[outputs.loki]]
domain = "http://victorialogs:9428"
endpoint = "/insert/loki/api/v1/push?_msg_field=docker_log.msg&_time_field=@timestamp&_stream_fields=log_source,metric_type"
namepass = ["docker_log"]
gzip_request = true
sanitize_label_names = true
[[outputs.http]]
url = "http://victoriametrics:8428/api/v1/write"
data_format = "prometheusremotewrite"
namepass = ["cpu"]
[outputs.http.headers]
Content-Type = "application/x-protobuf"
Content-Encoding = "snappy"
X-Prometheus-Remote-Write-Version = "0.1.0"
[[inputs.docker_log]]
[inputs.docker_log.tags]
metric_type = "logs"
log_source = "telegraf"
[[processors.rename]]
namepass = ["docker_log"]
[[processors.rename.replace]]
field = "message"
dest = "msg"

View file

@ -0,0 +1,3 @@
include:
- ../compose.yml
name: telegraf-syslog

View file

@ -0,0 +1,41 @@
[agent]
interval = "10s"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 100000
collection_jitter = "0s"
flush_interval = "10s"
flush_jitter = "0s"
precision = ""
debug = false
quiet = false
logtarget = "file"
logfile = "/dev/null"
hostname = "pop-os"
omit_hostname = false
[[inputs.cpu]]
[[outputs.syslog]]
address = "tcp://victorialogs:8094"
namepass = ["docker_log"]
[[outputs.http]]
url = "http://victoriametrics:8428/api/v1/write"
data_format = "prometheusremotewrite"
namepass = ["cpu"]
[outputs.http.headers]
Content-Type = "application/x-protobuf"
Content-Encoding = "snappy"
X-Prometheus-Remote-Write-Version = "0.1.0"
[[inputs.docker_log]]
[inputs.docker_log.tags]
metric_type = "logs"
log_source = "telegraf"
[[processors.rename]]
namepass = ["docker_log"]
[[processors.rename.replace]]
field = "message"
dest = "msg"

View file

@ -1,104 +0,0 @@
# Docker compose Vector integration with VictoriaLogs for docker. High-Availability example
The folder contains the example of integration of [vector](https://vector.dev/docs/) with VictoriaLogs Single-Node(s) and [vmauth](https://docs.victoriametrics.com/vmauth/) for achieving High Availability.
Check [this documentation](https://docs.victoriametrics.com/victorialogs/#high-availability) with a description of the architecture and components.
To spin-up environment run the following command:
```shell
docker compose up -d
```
To shut down the docker-compose environment run the following command:
```shell
docker compose down
docker compose rm -f
```
The docker compose file contains the following components:
* vector - vector is configured to collect logs from the `docker`, you can find configuration in the `vector.yaml`. It writes data in two instances of VictoriaLogs
* VictoriaLogs - the two instances of log database, they accept the data from `vector` by json line protocol
* vmauth - load balancer for proxying requests to one of VictoriaLogs
Querying the data
* [vmui](https://docs.victoriametrics.com/victorialogs/querying/#vmui) - a web UI is accessible by `http://localhost:8427/select/vmui/`
* for querying the data via command-line please check [these docs](https://docs.victoriametrics.com/victorialogs/querying/#command-line)
the example of vector configuration(`vector.yaml`)
```yaml
api:
enabled: true
address: 0.0.0.0:8686
sources:
docker:
type: docker_logs
transforms:
msg_parser:
type: remap
inputs:
- docker
source: |
if exists(.message) {
.log, err = parse_json(.message)
if err == null {
del(.message)
}
}
sinks:
console_out:
type: console
inputs:
- msg_parser
encoding:
codec: json
vlogs_http_1:
type: http
inputs:
- msg_parser
uri: http://victorialogs-1:9428/insert/jsonline?_stream_fields=source_type,host,container_name&_msg_field=log.msg&_time_field=timestamp
encoding:
codec: json
framing:
method: newline_delimited
compression: gzip
healthcheck:
enabled: false
request:
headers:
AccountID: '0'
ProjectID: '0'
vlogs_http_2:
type: http
inputs:
- msg_parser
uri: http://victorialogs-2:9428/insert/jsonline?_stream_fields=source_type,host,container_name&_msg_field=log.msg&_time_field=timestamp
encoding:
codec: json
framing:
method: newline_delimited
compression: gzip
healthcheck:
enabled: false
request:
headers:
AccountID: '0'
ProjectID: '0'
```
Please, note that `_stream_fields` parameter must follow recommended [best practices](https://docs.victoriametrics.com/victorialogs/keyconcepts/#stream-fields) to achieve better performance.
The example of vmauth configuration (`auth.yml`)
```yaml
unauthorized_user:
url_prefix:
- http://victorialogs-1:9428
- http://victorialogs-2:9428
```

View file

@ -1,6 +0,0 @@
# balance load among victorialogs instances
# see https://docs.victoriametrics.com/vmauth/#load-balancing
unauthorized_user:
url_prefix:
- http://victorialogs-1:9428
- http://victorialogs-2:9428

View file

@ -1,48 +0,0 @@
services:
vector:
image: docker.io/timberio/vector:0.40.1-distroless-static
restart: on-failure
volumes:
- type: bind
source: /var/run/docker.sock
target: /var/run/docker.sock
- type: bind
source: /var/lib/docker
target: /var/lib/docker
- ./vector.yaml:/etc/vector/vector.yaml:ro
user: root
ports:
- '8686:8686'
depends_on: [victorialogs-1,victorialogs-2]
victorialogs-1:
image: docker.io/victoriametrics/victoria-logs:v0.29.0-victorialogs
volumes:
- victorialogs-vector-docker-vl-ha-single-1:/vlogs
command:
- -storageDataPath=/vlogs
- -loggerFormat=json
victorialogs-2:
image: docker.io/victoriametrics/victoria-logs:v0.29.0-victorialogs
volumes:
- victorialogs-vector-docker-vl-ha-single-2:/vlogs
command:
- -storageDataPath=/vlogs
- -loggerFormat=json
vmauth:
container_name: vmauth
image: victoriametrics/vmauth:v1.103.0
depends_on:
- "victorialogs-1"
- "victorialogs-2"
volumes:
- ./auth.yml:/etc/auth.yml
command:
- '--auth.config=/etc/auth.yml'
ports:
- 8427:8427
restart: always
volumes:
victorialogs-vector-docker-vl-ha-single-1:
victorialogs-vector-docker-vl-ha-single-2:

View file

@ -1,58 +0,0 @@
api:
enabled: true
address: 0.0.0.0:8686
sources:
docker:
type: docker_logs
transforms:
msg_parser:
type: remap
inputs:
- docker
source: |
if exists(.message) {
.log, err = parse_json(.message)
if err == null {
del(.message)
}
}
sinks:
console_out:
type: console
inputs:
- msg_parser
encoding:
codec: json
vlogs_http_1:
type: http
inputs:
- msg_parser
uri: http://victorialogs-1:9428/insert/jsonline?_stream_fields=source_type,host,container_name&_msg_field=log.msg&_time_field=timestamp
encoding:
codec: json
framing:
method: newline_delimited
compression: gzip
healthcheck:
enabled: false
request:
headers:
AccountID: '0'
ProjectID: '0'
vlogs_http_2:
type: http
inputs:
- msg_parser
uri: http://victorialogs-2:9428/insert/jsonline?_stream_fields=source_type,host,container_name&_msg_field=log.msg&_time_field=timestamp
encoding:
codec: json
framing:
method: newline_delimited
compression: gzip
healthcheck:
enabled: false
request:
headers:
AccountID: '0'
ProjectID: '0'

View file

@ -1,8 +1,13 @@
# Docker compose Vector integration with VictoriaLogs for docker
# Docker compose Vector integration with VictoriaLogs using given below protocols:
* [elasticsearch](./elasticsearch)
* [loki](./loki)
* [jsonline single node](./jsonline)
* [jsonline HA setup](./jsonline-ha)
The folder contains the example of integration of [vector](https://vector.dev/docs/) with Victorialogs
To spin-up environment run the following command:
To spin-up environment `cd` to any of listed above directories run the following command:
```
docker compose up -d
```
@ -16,7 +21,7 @@ docker compose rm -f
The docker compose file contains the following components:
* vector - vector is configured to collect logs from the `docker`, you can find configuration in the `vector.yaml`. It writes data in VictoriaLogs. It pushes metrics to VictoriaMetrics.
* VictoriaLogs - the log database, it accepts the data from `vector` by elastic protocol
* VictoriaLogs - the log database, it accepts the data from `vector` by DataDog protocol
* VictoriaMetrics - collects metrics from `VictoriaLogs` and `VictoriaMetrics`
Querying the data
@ -24,40 +29,10 @@ Querying the data
* [vmui](https://docs.victoriametrics.com/victorialogs/querying/#vmui) - a web UI is accessible by `http://localhost:9428/select/vmui`
* for querying the data via command-line please check [these docs](https://docs.victoriametrics.com/victorialogs/querying/#command-line)
the example of vector configuration(`vector.yaml`)
```
sources:
docker:
type: docker_logs
transforms:
msg_parser:
type: remap
inputs:
- docker
source: |
.log = parse_json!(.message)
del(.message)
sinks:
vlogs_es:
type: elasticsearch
inputs:
- msg_parser
endpoints:
- http://victorialogs:9428/insert/elasticsearch/
mode: bulk
api_version: v8
compression: gzip
healthcheck.enabled: false
query:
_msg_field: log.msg
_time_field: timestamp
_stream_fields: source_type,host,container_name
request:
headers:
AccountID: "0"
ProjectID: "0"
```
Vector configuration example can be found below:
* [elasticsearch](./elasticsearch/vector.yaml)
* [loki](./loki/vector.yaml)
* [jsonline single node](./jsonline/vector.yaml)
* [jsonline HA setup](./jsonline-ha/vector.yaml)
Please, note that `_stream_fields` parameter must follow recommended [best practices](https://docs.victoriametrics.com/victorialogs/keyconcepts/#stream-fields) to achieve better performance.

View file

@ -1,6 +1,8 @@
include:
- ../compose.yml
services:
vector:
image: docker.io/timberio/vector:0.38.0-distroless-static
image: docker.io/timberio/vector:0.40.0-distroless-static
restart: on-failure
volumes:
- type: bind
@ -9,7 +11,7 @@ services:
- type: bind
source: /var/lib/docker
target: /var/lib/docker
- ./vector.yaml:/etc/vector/vector.yaml:ro
- ${PWD}/vector.yaml:/etc/vector/vector.yaml:ro
user: root
ports:
- '8686:8686'
@ -18,39 +20,3 @@ services:
condition: service_healthy
victoriametrics:
condition: service_healthy
victorialogs:
image: docker.io/victoriametrics/victoria-logs:v0.29.0-victorialogs
volumes:
- victorialogs-vector-docker-vl:/vlogs
ports:
- '9428:9428'
command:
- -storageDataPath=/vlogs
- -loggerFormat=json
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:9428/health"]
interval: 1s
timeout: 1s
retries: 10
victoriametrics:
image: victoriametrics/victoria-metrics:latest
ports:
- '8428:8428'
command:
- -storageDataPath=/vmsingle
- -promscrape.config=/promscrape.yml
- -loggerFormat=json
volumes:
- victorialogs-vector-docker-vm:/vmsingle
- ./scrape.yml:/promscrape.yml
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:8428/health"]
interval: 1s
timeout: 1s
retries: 10
volumes:
victorialogs-vector-docker-vl:
victorialogs-vector-docker-vm:

View file

@ -0,0 +1,3 @@
include:
- ../compose.yml
name: vector-elasticsearch

View file

@ -0,0 +1,43 @@
api:
enabled: true
address: 0.0.0.0:8686
sources:
docker:
type: docker_logs
demo:
type: demo_logs
format: apache_common
interval: 10
vector_metrics:
type: internal_metrics
transforms:
msg_parser:
type: remap
inputs: [docker]
source: |
.log = parse_json!(.message)
del(.message)
sinks:
elasticsearch:
type: elasticsearch
inputs: [demo]
endpoints: [http://victorialogs:9428/insert/elasticsearch/]
mode: bulk
api_version: v8
compression: gzip
healthcheck:
enabled: false
query:
_msg_field: message
_time_field: timestamp
_stream_fields: source_type
request:
headers:
AccountID: "0"
ProjectID: "0"
victoriametrics:
type: prometheus_remote_write
endpoint: http://victoriametrics:8428/api/v1/write
inputs: [vector_metrics]
healthcheck:
enabled: false

View file

@ -0,0 +1,5 @@
include:
- path:
- ../compose.yml
- ../../compose-ha.yml
name: vector-jsonline-ha

View file

@ -18,7 +18,7 @@ transforms:
.log = parse_json!(.message)
del(.message)
sinks:
vlogs_http:
vlogs-1:
type: http
inputs:
- msg_parser
@ -34,17 +34,22 @@ sinks:
headers:
AccountID: '0'
ProjectID: '0'
vlogs_loki:
type: loki
vlogs-2:
type: http
inputs:
- demo
endpoint: http://victorialogs:9428/insert/loki/
compression: gzip
path: /api/v1/push?_msg_field=message.message&_time_field=timestamp&_stream_fields=source
- msg_parser
uri: http://victorialogs-2:9428/insert/jsonline?_stream_fields=source_type,host,container_name&_msg_field=log.msg&_time_field=timestamp
encoding:
codec: json
labels:
source: vector
framing:
method: newline_delimited
compression: gzip
healthcheck:
enabled: false
request:
headers:
AccountID: '0'
ProjectID: '0'
victoriametrics:
type: prometheus_remote_write
endpoint: http://victoriametrics:8428/api/v1/write
@ -52,22 +57,3 @@ sinks:
- metrics
healthcheck:
enabled: false
vlogs_es:
type: elasticsearch
inputs:
- demo
endpoints:
- http://victorialogs:9428/insert/elasticsearch/
mode: bulk
api_version: v8
compression: gzip
healthcheck:
enabled: false
query:
_msg_field: message
_time_field: timestamp
_stream_fields: source_type
request:
headers:
AccountID: '0'
ProjectID: '0'

View file

@ -0,0 +1,3 @@
include:
- ../compose.yml
name: vector-jsonline

View file

@ -0,0 +1,43 @@
api:
enabled: true
address: 0.0.0.0:8686
sources:
docker:
type: docker_logs
demo:
type: demo_logs
format: json
metrics:
type: internal_metrics
transforms:
msg_parser:
type: remap
inputs:
- docker
source: |
.log = parse_json!(.message)
del(.message)
sinks:
http:
type: http
inputs:
- msg_parser
uri: http://victorialogs:9428/insert/jsonline?_stream_fields=source_type,host,container_name&_msg_field=log.msg&_time_field=timestamp
encoding:
codec: json
framing:
method: newline_delimited
compression: gzip
healthcheck:
enabled: false
request:
headers:
AccountID: '0'
ProjectID: '0'
victoriametrics:
type: prometheus_remote_write
endpoint: http://victoriametrics:8428/api/v1/write
inputs:
- metrics
healthcheck:
enabled: false

View file

@ -0,0 +1,3 @@
include:
- ../compose.yml
name: vector-loki

View file

@ -0,0 +1,38 @@
api:
enabled: true
address: 0.0.0.0:8686
sources:
docker:
type: docker_logs
demo:
type: demo_logs
format: json
metrics:
type: internal_metrics
transforms:
msg_parser:
type: remap
inputs:
- docker
source: |
.log = parse_json!(.message)
del(.message)
sinks:
loki:
type: loki
inputs:
- demo
endpoint: http://victorialogs:9428/insert/loki/
compression: gzip
path: /api/v1/push?_msg_field=message.message&_time_field=timestamp&_stream_fields=source
encoding:
codec: json
labels:
source: vector
victoriametrics:
type: prometheus_remote_write
endpoint: http://victoriametrics:8428/api/v1/write
inputs:
- metrics
healthcheck:
enabled: false

View file

@ -1,11 +0,0 @@
scrape_configs:
- job_name: "victoriametrics"
scrape_interval: 30s
static_configs:
- targets:
- victoriametrics:8428
- job_name: "victorialogs"
scrape_interval: 30s
static_configs:
- targets:
- victorialogs:9428

View file

@ -120,4 +120,4 @@ See also:
- [Data ingestion troubleshooting](https://docs.victoriametrics.com/victorialogs/data-ingestion/#troubleshooting).
- [How to query VictoriaLogs](https://docs.victoriametrics.com/victorialogs/querying/).
- [Elasticsearch output docs for Telegraf](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/elasticsearch).
- [Docker-compose demo for Telegraf integration with VictoriaLogs](https://github.com/VictoriaMetrics/VictoriaMetrics/tree/master/deployment/docker/victorialogs/telegraf-docker).
- [Docker-compose demo for Telegraf integration with VictoriaLogs](https://github.com/VictoriaMetrics/VictoriaMetrics/tree/master/deployment/docker/victorialogs/telegraf).

View file

@ -213,4 +213,4 @@ See also:
- [Data ingestion troubleshooting](https://docs.victoriametrics.com/victorialogs/data-ingestion/#troubleshooting).
- [How to query VictoriaLogs](https://docs.victoriametrics.com/victorialogs/querying/).
- [Elasticsearch output docs for Vector](https://vector.dev/docs/reference/configuration/sinks/elasticsearch/).
- [Docker-compose demo for Filebeat integration with VictoriaLogs](https://github.com/VictoriaMetrics/VictoriaMetrics/tree/master/deployment/docker/victorialogs/vector).
- [Docker-compose demo for Vector integration with VictoriaLogs](https://github.com/VictoriaMetrics/VictoriaMetrics/tree/master/deployment/docker/victorialogs/vector).