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
@@ -32,13 +39,8 @@ Configure Rsyslog to gather logs from your host, containers, and services.
32
39
33
40
### Log collection
34
41
35
-
#### Rsyslog version >=8
36
42
<divclass="alert alert-info"> From <ahref="https://www.rsyslog.com/doc/configuration/modules/imfile.html#mode">version 8.1.5</a> Rsyslog recommends <code>inotify</code> mode. Traditionally, <code>imfile</code> used polling mode, which is much more resource-intense (and slower) than <code>inotify</code> mode. </div>
37
43
38
-
{{< tabs >}}
39
-
40
-
{{% tab "Ubuntu and Debian" %}}
41
-
42
44
1. Activate the `imfile` module to monitor specific log files. To add the `imfile` module, add the following to your `rsyslog.conf`:
43
45
44
46
```conf
@@ -47,26 +49,6 @@ Configure Rsyslog to gather logs from your host, containers, and services.
47
49
48
50
2. Create an `/etc/rsyslog.d/datadog.conf` file.
49
51
50
-
{{< site-region region="us,eu" >}}
51
-
52
-
3. In `/etc/rsyslog.d/datadog.conf`, add the following configuration and replace `<site_url>` with **{{< region-param key="dd_site" >}}** and `<API_KEY>` with your Datadog API key. You must include a separate `input` line for each log file you want to monitor:
3. In `/etc/rsyslog.d/datadog.conf`, add the following configuration. Replace `<site_url>` with **{{< region-param key="dd_site" >}}** and `<API_KEY>` with your Datadog API key. You must include a separate `input` line for each log file you want to monitor:
71
53
72
54
```conf
@@ -83,7 +65,6 @@ Configure Rsyslog to gather logs from your host, containers, and services.
1. Activate the `imfile` module to monitor specific log files. To add the `imfile` module, add the following to your `rsyslog.conf`:
178
-
179
-
```conf
180
-
module(load="imfile" PollingInterval="10") #needs to be done just once
181
-
```
182
-
183
-
2. Create an `/etc/rsyslog.d/datadog.conf` file.
184
-
185
-
{{< site-region region="us,eu" >}}
186
-
187
-
3. In `/etc/rsyslog.d/datadog.conf`, add the following configuration and replace `<site_url>` with **{{< region-param key="dd_site" >}}** and `<API_KEY>` with your Datadog API key. You must include a separate `input` line for each log file you want to monitor:
3. In `/etc/rsyslog.d/datadog.conf`, add the following configuration. Replace `<site_url>` with **{{< region-param key="dd_site" >}}** and `<API_KEY>` with your Datadog API key. You must include a separate `input` line for each log file you want to monitor:
4. Restart Rsyslog. Your new logs are forwarded directly to your Datadog account.
224
-
```shell
225
-
sudo systemctl restart rsyslog
226
-
```
227
-
228
-
5. Associate your logs with the host metrics and tags:
229
-
230
-
To make sure that your logs are associated with the metrics and tags from the same host in your Datadog account, set the `HOSTNAME` in your `rsyslog.conf` to match the hostname of your Datadog metrics.
231
-
- If you specified a hostname in `datadog.conf` or `datadog.yaml`, replace the `%HOSTNAME%` value in `rsyslog.conf` to match your hostname.
232
-
- If you did not specify a hostname in `datadog.conf` or `datadog.yaml`, you do not need to change anything.
233
-
234
-
6. To get the best use out of your logs in Datadog, set a source for the logs.
235
-
- If you [forward your logs to the Datadog Agent][1], you can set the source in the Agent configuration file.
236
-
- If you're not forwarding your logs to the Datadog Agent, create a distinct configuration file for each source in `/etc/rsyslog.d/`:
237
-
238
-
To set the source, use the following format (if you have several sources, change the name of the format in each file):
7. (Optional) Datadog cuts inactive connections after a period of inactivity. Some versions of Rsyslog are not able to reconnect when necessary. To mitigate this issue, use time markers so the connection never stops:
251
-
252
-
1. Add the following two lines to your Rsyslog configuration file:
253
-
254
-
```conf
255
-
$ModLoad immark
256
-
$MarkMessagePeriod 20
257
-
```
258
-
259
-
2. Restart the Rsyslog service:
260
-
261
-
```shell
262
-
sudo systemctl restart rsyslog
263
-
```
264
-
265
-
{{% site-region region="us" %}}
266
-
8. (Optional) Add TLS Encryption to logs sent from Rsyslog to your Datadog account.
267
-
1. Install the `rsyslog-gnutls` and `ca-certificates` packages:
268
-
```shell
269
-
sudo yum install rsyslog-gnutls ca-certificates
270
-
```
271
-
2. Add the following line to the bottom of your `/etc/rsyslog.d/datadog.conf` file:
1. Activate the `imfile` module to monitor specific log files. To add the `imfile` module, add the following to your `rsyslog.conf`:
314
-
315
-
```conf
316
-
module(load="imfile" PollingInterval="10") #needs to be done just once
317
-
```
318
-
319
-
2. Create an `/etc/rsyslog.d/datadog.conf` file.
320
-
321
-
322
-
{{< site-region region="us,eu" >}}
323
-
324
-
3. In `/etc/rsyslog.d/datadog.conf`, add the following configuration and replace `<site_url>` with **{{< region-param key="dd_site" >}}** and `<API_KEY>` with your Datadog API key. You must include a separate `input` line for each log file you want to monitor:
3. In `/etc/rsyslog.d/datadog.conf`, add the following configuration. Replace `<site_url>` with **{{< region-param key="dd_site" >}}** and `<API_KEY>` with your Datadog API key. You must include a separate `input` line for each log file you want to monitor:
4. Restart Rsyslog. Your new logs are forwarded directly to your Datadog account.
361
-
```shell
362
-
sudo systemctl restart rsyslog
363
-
```
364
-
365
-
5. Associate your logs with the host metrics and tags:
366
-
367
-
To make sure that your logs are associated with the metrics and tags from the same host in your Datadog account, set the `HOSTNAME` in your `rsyslog.conf` to match the hostname of your Datadog metrics.
368
-
- If you specified a hostname in `datadog.conf` or `datadog.yaml`, replace the `%HOSTNAME%` value in `rsyslog.conf` to match your hostname.
369
-
- If you did not specify a hostname in `datadog.conf` or `datadog.yaml`, you do not need to change anything.
370
-
371
-
6. To get the best use out of your logs in Datadog, set a source for the logs.
372
-
- If you [forward your logs to the Datadog Agent][1], you can set the source in the Agent configuration file.
373
-
- If you're not forwarding your logs to the Datadog Agent, create a distinct configuration file for each source in `/etc/rsyslog.d/`:
374
-
375
-
To set the source, use the following format (if you have several sources, change the name of the format in each file):
7. (Optional) Datadog cuts inactive connections after a period of inactivity. Some versions of Rsyslog are not able to reconnect when necessary. To mitigate this issue, use time markers so the connection never stops:
388
-
389
-
1. Add the following two lines to your Rsyslog configuration file:
390
-
391
-
```conf
392
-
$ModLoad immark
393
-
$MarkMessagePeriod 20
394
-
```
395
-
396
-
2. Restart the Rsyslog service:
397
-
398
-
```shell
399
-
sudo systemctl restart rsyslog
400
-
```
401
-
402
-
{{% site-region region="us" %}}
403
-
8. (Optional) Add TLS Encryption to logs sent from Rsyslog to your Datadog account.
404
-
1. Install the `rsyslog-gnutls` and `ca-certificates` packages:
405
-
```shell
406
-
sudo dnf install rsyslog-gnutls ca-certificates
407
-
```
408
-
2. Add the following line to the bottom of your `/etc/rsyslog.d/datadog.conf` file:
0 commit comments