Skip to content

Instantly share code, notes, and snippets.

@LaurenceJJones
Last active June 1, 2022 19:59
Show Gist options
  • Save LaurenceJJones/ba2d7196a2959aff48b67a2caf4b3f72 to your computer and use it in GitHub Desktop.
Save LaurenceJJones/ba2d7196a2959aff48b67a2caf4b3f72 to your computer and use it in GitHub Desktop.
Mongodb > 4.4 crowdsec parser WIP
filter: "evt.Parsed.program == 'mongo'"
onsuccess: next_stage
name: crowdsecurity/myservice-logs
description: "Mongodb4.4"
debug: true
nodes:
- grok:
pattern: '%{IPORHOST:remote_addr}:%{NUMBER}'
expression: JsonExtract(evt.Line.Raw, "attr.remote")
- grok:
pattern: '%{TIMESTAMP_ISO8601:timestamp}'
expression: JsonExtract(evt.Line.Raw, "t.$date")
statics:
- meta: log_type
value: mongodb_failed_auth
- meta: source_ip
expression: evt.Parsed.remote_addr
- target: evt.StrTime
expression: evt.Parsed.timestamp
- meta: sub_type
expression: JsonExtract(evt.Line.Raw, "msg")
{"t":{"$date":"2022-06-01T14:37:11.545+00:00"},"s":"I", "c":"ACCESS", "id":20249, "ctx":"conn3","msg":"Authentication failed","attr":{"mechanism":"SCRAM-SHA-1","speculative":false,"principalName":"admin","authenticationDatabase":"admin","remote":"127.0.0.1:33632","extraInfo":{},"error":"UserNotFound: Could not find user \"admin\" for db \"admin\""}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment