Skip to content

Commit ac12627

Browse files
committed
up
1 parent 8fccc77 commit ac12627

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

crowdsec-docs/unversioned/user_guides/log_centralization.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,23 @@ Finally, restart rsyslog to use the new configuration:
6565
systemctl restart rsyslog
6666
```
6767

68+
We will also setup logrotate to avoid filling our disk with the logs. Create a file `/etc/logrotate.d/remote-logs` with the following content:
69+
```
70+
/var/log/remote-logs/*/*.log {
71+
daily
72+
rotate 7
73+
compress
74+
missingok
75+
notifempty
76+
create 0640 syslog adm
77+
sharedscripts
78+
postrotate
79+
/bin/systemctl reload rsyslog.service > /dev/null 2>&1 || true
80+
endscript
81+
}
82+
```
83+
84+
This will keep 7 days of compressed logs.
6885

6986
## Rsyslog Client Setup
7087

@@ -76,6 +93,8 @@ access_log syslog:server=<central-server-ip>;
7693
error_log syslog:server=<central-server-ip>;
7794
```
7895

96+
As nginx supports multiple `access_log` and `error_log` directives, you can keep the existing directives to still have a local copy of the logs.
97+
7998
### Auth logs
8099

81100
Create a file `/etc/rsyslog.d/99-auth-forward.conf` with the following content:
@@ -124,8 +143,6 @@ labels:
124143
type: syslog
125144
```
126145

127-
128-
129146
Note that we are setting the type label to `syslog`. This will instruct crowdsec to use the `syslog` parser to extract the actual type from the log itself.
130147

131148
Then, we need to install the nginx collection for crowdsec to be able to detect attacks:

0 commit comments

Comments
 (0)