Database mysql problem

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

Hello,

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.

Hello,

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 :

common:
daemonize: true
pid_dir: /var/run/
log_media: file
log_level: info
log_dir: /var/log/
working_dir: .
config_paths:
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
crowdsec_service:
acquisition_path: /etc/crowdsec/acquis.yaml
parser_routines: 1
cscli:
output: human
db_config:
log_level: info
type: mysql
user: …
password: …
db_name: …
host: …
port: 3306
flush:
max_items: 5000
max_age: 7d
api:
client:
insecure_skip_verify: false
credentials_path: /etc/crowdsec/local_api_credentials.yaml
server:
log_level: info
listen_uri: 127.0.0.1:8080
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

tls:

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

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

prometheus:
enabled: true
level: full
listen_addr: 127.0.0.1
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.