Database mysql problem

FATA[06-05-2021 08:18:55 AM] yaml: line 24: did not find expected key


When i try to configure mysql distant database, after saving file, i try to add a machine but i receive an alert and the crowdsec service stopping…

message = level=fatal msg=“yaml: line 21: did not find expected key”

When i look in the config file, the line 21 is about the db_path: /var/lib/crowdsec/data/crowdsec.db
I comment it …

I follow the tutorial database Databases - Crowdsec

I try to telnet the distant port server and it’s work, so the comunication between the two servers is working.

here is my config :

crowdsec distant database config

Could you help me please.


Looks like your issue is caused by a bad indentation in your YAML config: log_level and type are indented with 2 spaces, while the rest of the db_config object is indented with 1 space.

Indent everything with only 1 space, and your issue should be fixed :slight_smile:

Thanks for your reply,

I try what you said me but it not seems to be working…
I still have the same message : (here my modification about indented… i kept the 2 spaces default indented)

crowdsec distant database config

Here the error message after trying to start crowdsec service with sudo systemctl start crowdsec

Which version of crowdsec are you using ?
Can you upload your configuration file (after redacting all sensitives information) so I can have a closer look ?

Hi, Thanks for helping me.
The version is : 1.0.13 (last version)

Here the conf with exact syntax :

daemonize: true
pid_dir: /var/run/
log_media: file
log_level: info
log_dir: /var/log/
working_dir: .
config_dir: /etc/crowdsec/
data_dir: /var/lib/crowdsec/data/
simulation_path: /etc/crowdsec/simulation.yaml
hub_dir: /etc/crowdsec/hub/
index_path: /etc/crowdsec/hub/.index.json
acquisition_path: /etc/crowdsec/acquis.yaml
parser_routines: 1
output: human
log_level: info
type: mysql
user: …
password: …
db_name: …
host: …
port: 3306
max_items: 5000
max_age: 7d
insecure_skip_verify: false
credentials_path: /etc/crowdsec/local_api_credentials.yaml
log_level: info
profiles_path: /etc/crowdsec/profiles.yaml
online_client: # Crowdsec API credentials (to push signals and receive bad IPs)
credentials_path: /etc/crowdsec/online_api_credentials.yaml


cert_file: /etc/crowdsec/ssl/cert.pem

key_file: /etc/crowdsec/ssl/key.pem

enabled: true
level: full
listen_port: 6060

Unfortunately, discource messed your config :confused:
I tried to recreate it based on your screenshot, but I am unable to reproduce your error.
The only way I managed to do it was to randomly removing one space before a key, so something must still be wrong with your indentation.
If you want, you can drop by our gitter (crowdsec-project/community - Gitter) so that we can try to debug your issue live.