Skip to content

Commit 2e9608f

Browse files
log_processor/data_sources/victorialogs: add new datasource (#727)
Co-authored-by: Laurence Jones <[email protected]>
1 parent 83ce4b3 commit 2e9608f

File tree

3 files changed

+120
-0
lines changed

3 files changed

+120
-0
lines changed

crowdsec-docs/docs/log_processor/data_sources/introduction.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Name | Type | Stream | One-shot
2323
[Kafka](/log_processor/data_sources/kafka.md)| read logs from kafka topic | yes | no
2424
[Kubernetes Audit](/log_processor/data_sources/kubernetes_audit.md) | expose a webhook to receive audit logs from a Kubernetes cluster | yes | no
2525
[Loki](/log_processor/data_sources/loki.md) | read logs from loki | yes | yes
26+
[VictoriaLogs](/log_processor/data_sources/victorialogs.md) | read logs from VictoriaLogs | yes | yes
2627
[syslog service](/log_processor/data_sources/syslog_service.md) | read logs received via syslog protocol | yes | no
2728
[Windows Event](/log_processor/data_sources/windows_event_log.md)| read logs from windows event log | yes | yes
2829

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
---
2+
id: victorialogs
3+
title: VictoriaLogs
4+
---
5+
6+
This module allows the `Security Engine` to acquire logs from VictoriaLogs query.
7+
8+
## Configuration example
9+
10+
This will allow to read logs from VictoriaLogs, using the query `app:nginx`.
11+
```yaml
12+
source: victorialogs
13+
mode: tail
14+
log_level: info
15+
url: http://localhost:9428/
16+
limit: 1000
17+
query: |
18+
app:nginx
19+
auth:
20+
username: something
21+
password: secret
22+
labels:
23+
type: nginx
24+
```
25+
26+
:::info
27+
The reader will always start at "now" for `tail` mode.
28+
:::
29+
30+
Look at the `configuration parameters` to view all supported options.
31+
32+
## Parameters
33+
34+
### `mode`
35+
36+
Mode to fetch the logs, supported values: `tail` and `cat`.
37+
38+
Defaults to `tail`.
39+
40+
### `url`
41+
42+
The VictoriaLogs URL to connect to.
43+
44+
Required.
45+
46+
### `prefix`
47+
48+
The VictoriaLogs prefix (present in http path, useful if VictoriaLogs is behind a reverse-proxy).
49+
50+
Defaults to `/`.
51+
52+
### `query`
53+
54+
The [VictoriaLogs query](https://docs.victoriametrics.com/victorialogs/logsql/).
55+
56+
Required.
57+
58+
Note that `tail` requests have limitations for operators used query. See [this doc](https://docs.victoriametrics.com/victorialogs/querying/#live-tailing) for the details.
59+
60+
### `limit`
61+
62+
The maximum number of messages to be retried from VictoriaLogs at once.
63+
64+
### `headers`
65+
66+
Allows you to specify headers to be sent to VictoriaLogs, in the format:
67+
68+
```yaml
69+
headers:
70+
foo: bar
71+
AccountID: 0
72+
ProjectID: 0
73+
```
74+
75+
See this doc for more information: [VictoriaLogs headers](https://docs.victoriametrics.com/victorialogs/querying/#http-api)
76+
77+
### `wait_for_ready`
78+
79+
The retry interval at startup before giving on VictoriaLogs.
80+
81+
Defaults to `10 seconds`.
82+
83+
### `auth`
84+
85+
Login/password authentication for VictoriaLogs, in the format:
86+
87+
```yaml
88+
auth:
89+
username: someone
90+
password: something
91+
```
92+
93+
### `max_failure_duration`
94+
95+
The maximum duration VictoriaLogs is allowed to be unavailable (once startup is successful) before giving up on the data source.
96+
97+
Default to `30 seconds`.
98+
99+
100+
## DSN and command-line
101+
102+
All the parameters above are available via DNS (one-shot mode), plus the following ones:
103+
104+
### `ssl`
105+
106+
if present, scheme will be set to `https`
107+
108+
### `since`
109+
110+
Allows to set the "start" duration for VictoriaLogs query.
111+
112+
### `log_level`
113+
114+
Set the `log_level` for VictoriaLogs datasource.
115+
116+
```bash
117+
crowdsec -type foobar -dsn 'victorialogs://login:password@localhost:9428/?query=server:"demoVictoriaLogsVictoriaLogs"'
118+
```

crowdsec-docs/sidebars.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ module.exports = {
122122
"log_processor/data_sources/kafka",
123123
"log_processor/data_sources/kubernetes_audit",
124124
"log_processor/data_sources/loki",
125+
"log_processor/data_sources/victorialogs",
125126
"log_processor/data_sources/syslog",
126127
"log_processor/data_sources/windows_evt_log",
127128
"log_processor/data_sources/troubleshoot",

0 commit comments

Comments
 (0)