Add new log sources
Once you have found service you want to add, you can use the cscli
command line tool to add the collection.
- Linux/Freebsd
- Windows
- Kubernetes
cscli collections add <collection_name>
cscli.exe collections add <collection_name>
# In your values.yml file
agent:
env:
- name: COLLECTIONS
value: '<collection_name>'
Once the collection has been downloaded we need to add a new Acquisition to the configuration so CrowdSec knows where to find the log source.
Create the directory if it does not exist
- Linux/Freebsd
- Windows
sudo mkdir -p /etc/crowdsec/acquis.d
- Powershell
- CMD
New-Item -ItemType Directory -Force -Path C:\ProgramData\CrowdSec\Config\acquis.d\
mkdir C:\ProgramData\CrowdSec\Config\acquis.d\
Create the acquisition file
- Linux/Freebsd
- Windows
- Kubernetes
sudo touch /etc/crowdsec/acquis.d/<collection_name>.yaml
- Powershell
- CMD
New-Item -ItemType File -Force -Path C:\ProgramData\CrowdSec\Config\acquis.d\<collection_name>.yaml
.>C:\ProgramData\CrowdSec\Config\acquis.d\<collection_name>.yaml 2>NUL
# In your values.yml file
agent:
# -- To add custom acquisitions using available datasources (https://docs.crowdsec.net/docs/next/data_sources/intro)
additionalAcquisition:
- source: file
filenames:
- '/path/to/your/file.log' ## Single file
- '/path/to/your/files*' ## Wildcard support
labels:
type: '<type of logs>' ## Type defined in the parser
Add the following contents to the file
<collection_name>.yaml
filenames:
- "/path/to/your/file.log" ## Single file
- "/path/to/your/files*" ## Wildcard support
labels:
type: "<type of logs>" ## Type defined in the parser
Once you have added the acquisitions you can test the configuration and restart the service.
- Linux/Freebsd
- Windows
- Kubernetes
sudo crowdsec -t && sudo systemctl restart crowdsec
- Powershell
- CMD
Restart-Service crowdsec
net stop crowdsec && net start crowdsec
helm upgrade -f values.yaml crowdsec crowdsecurity/crowdsec
Next Steps?
Now that you have added a new acquisition, you may want to verify that the logs are being parsed correctly see are detected log sources working correctly?