You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -7,6 +7,8 @@ This module allows the `Security Engine` to acquire logs from running containers
7
7
8
8
## Configuration example
9
9
10
+
### Container
11
+
10
12
To monitor a given container name or ID:
11
13
12
14
```yaml
@@ -31,71 +33,115 @@ labels:
31
33
type: log_type
32
34
```
33
35
36
+
### Swarm
37
+
38
+
To monitor a given Swarm service name or ID:
39
+
40
+
```yaml
41
+
source: docker
42
+
service_name:
43
+
- my_service_name
44
+
service_id:
45
+
- abcdef123456
46
+
labels:
47
+
type: log_type
48
+
```
49
+
50
+
To monitor Swarm services name or ID matching a regex:
51
+
52
+
```yaml
53
+
source: docker
54
+
service_name_regexp:
55
+
- web_*
56
+
service_id_regexp:
57
+
- svc-*
58
+
labels:
59
+
type: log_type
60
+
```
61
+
34
62
Look at the `configuration parameters` to view all supported options.
35
63
64
+
36
65
## Parameters
37
66
67
+
:::warning
68
+
you should not mix `container` options and `swarm` options as it may lead to duplicate logs being read. if you plan to use `swarm` options solely use these options.
69
+
:::
70
+
71
+
### Container
38
72
39
-
### `container_name`
73
+
#### `container_name`
40
74
41
75
List of containers names to monitor.
42
76
43
-
### `container_id`
77
+
#### `container_id`
44
78
45
79
List of containers IDs to monitor.
46
80
47
-
### `container_name_regexp`
81
+
#### `container_name_regexp`
48
82
49
83
List of regexp matching containers names to monitor.
50
84
51
-
### `container_id_regexp`
85
+
#### `container_id_regexp`
52
86
53
87
List of regexp matching containers ID to monitor.
54
88
55
-
### `docker_host`
89
+
#### `use_container_labels`
56
90
57
-
Docker host.
91
+
Forces the use of container labels to get the log type. Meaning you can define a single docker datasource and let the labels of the container define the log type.
58
92
59
-
Default: `unix:///var/run/docker.sock`
93
+
```yaml
94
+
source: docker
95
+
use_container_labels: true
96
+
```
60
97
61
-
### `until`
98
+
Currently here is the list of reserved labels for the container:
62
99
63
-
Read logs until timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes).
100
+
`crowdsec.enable` : Enable crowdsec acquisition for this container the value must be set to `crowdsec.enable=true` for the container to be adopted.
64
101
65
-
### `since`
102
+
`crowdsec.labels` : Top level key that will parse into the labels struct for the acquisition, for example `crowdsec.labels.type=nginx` will be parsed to the following:
66
103
67
-
Read logs since timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes).
104
+
```yaml
105
+
labels:
106
+
type: nginx
107
+
```
68
108
69
-
### `check_interval`
109
+
Here is an example of running a nginx container with the labels:
70
110
71
-
Relative interval (e.g. 5s for 5 seconds) to check for new containers matching the configuration.
111
+
```bash
112
+
docker run -d --label crowdsec.enable=true --label crowdsec.labels.type=nginx nginx:alpine
113
+
```
72
114
73
-
Default: `1s`
115
+
### Swarm
74
116
75
-
### `follow_stdout`
117
+
#### `service_name`
76
118
77
-
Follow `stdout` containers logs.
119
+
List of service names to monitor.
78
120
79
-
Default: `true`
121
+
#### `service_id`
80
122
81
-
### `follow_stderr`
123
+
List of service IDs to monitor.
82
124
83
-
Follow `stderr` container logs.
125
+
#### `service_name_regexp`
84
126
85
-
Default: `true`
127
+
List of regexp matching service names to monitor.
86
128
87
-
### `use_container_labels`
129
+
#### `service_id_regexp`
88
130
89
-
Forces the use of container labels to get the log type. Meaning you can define a single docker datasource and let the labels of the container define the log type.
131
+
List of regexp matching service ID to monitor
132
+
133
+
#### `use_service_labels`
134
+
135
+
Forces the use of service labels to get the log type. Meaning you can define a single docker datasource and let the labels of the service define the log type.
90
136
91
137
```yaml
92
138
source: docker
93
-
use_container_labels: true
139
+
use_service_labels: true
94
140
```
95
141
96
-
Currently here is the list of reserved labels for the container:
142
+
Currently here is the list of reserved labels for the service:
97
143
98
-
`crowdsec.enable` : Enable crowdsec acquisition for this container the value must be set to `crowdsec.enable=true` for the container to be adopted.
144
+
`crowdsec.enable` : Enable crowdsec acquisition for this service the value must be set to `crowdsec.enable=true` for the service to be adopted.
99
145
100
146
`crowdsec.labels` : Top level key that will parse into the labels struct for the acquisition, for example `crowdsec.labels.type=nginx` will be parsed to the following:
101
147
@@ -104,15 +150,56 @@ labels:
104
150
type: nginx
105
151
```
106
152
107
-
Here is an example of running a nginx container with the labels:
153
+
Here is an example of running a service using nginx with the labels:
108
154
109
155
```bash
110
-
docker run -d --label crowdsec.enable=true --label crowdsec.labels.type=nginx nginx:alpine
156
+
docker service create \
157
+
--name test-nginx \
158
+
--label crowdsec.enable=true \
159
+
--label crowdsec.labels.type=nginx \
160
+
--replicas 2 \
161
+
nginx:latest
111
162
```
112
163
164
+
### `docker_host`
165
+
166
+
Docker host.
167
+
168
+
Default: `unix:///var/run/docker.sock`
169
+
170
+
### `until`
171
+
172
+
Read logs until timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes).
173
+
174
+
### `since`
175
+
176
+
Read logs since timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes).
177
+
178
+
### `check_interval`
179
+
180
+
Relative interval (e.g. 5s for 5 seconds) to check for new containers matching the configuration.
181
+
182
+
Default: `1s`
183
+
184
+
### `follow_stdout`
185
+
186
+
Follow `stdout` containers logs.
187
+
188
+
Default: `true`
189
+
190
+
### `follow_stderr`
191
+
192
+
Follow `stderr` container logs.
193
+
194
+
Default: `true`
195
+
113
196
114
197
## DSN and command-line
115
198
199
+
:::info
200
+
DSN does not support reading from Swarm services
201
+
:::
202
+
116
203
docker datasource implements a very approximative DSN, as follows : `docker://<docker_name_or_id>?[args]`
0 commit comments