I have configured a program (Vault) to log its audit trail in JSON to syslog and I have configured a decoder using json.
In ossec-logtest, I can see my json decoder is called but my custom rule is not triggered, only the default rule 1002 of syslog is triggered because event matches "error" word.
It's not clear to me how the analysis decides between 2 rules that match same event with 2 different decoders.
Jun 13 17:48:21 ps-vault1 vault[3881]: {"time":"2018-06-13T15:48:21.697524573Z","type":"request","auth":{"client_token":"","accessor":"","display_name":"","policies":null,"metadata":null,"entity_id":""},"request":{"id":"0db6af6c-65ed-4bbe-71b3-45f759cc5c6f","operation":"update","client_token":"","client_token_accessor":"","path":"auth/ldap/login/marziou","data":{"password":"hmac-sha256:1509bd55629fb62baf8dce9bd3055b53a9204dde7b0dcb79ae126a8c758b03b7"},"policy_override":false,"remote_address":"192.168.89.10","wrap_ttl":0,"headers":{}},"error":""}
**Phase 1: Completed pre-decoding.
full event: 'Jun 13 17:48:21 ps-vault1 vault[3881]: {"time":"2018-06-13T15:48:21.697524573Z","type":"request","auth":{"client_token":"","accessor":"","display_name":"","policies":null,"metadata":null,"entity_id":""},"request":{"id":"0db6af6c-65ed-4bbe-71b3-45f759cc5c6f","operation":"update","client_token":"","client_token_accessor":"","path":"auth/ldap/login/marziou","data":{"password":"hmac-sha256:1509bd55629fb62baf8dce9bd3055b53a9204dde7b0dcb79ae126a8c758b03b7"},"policy_override":false,"remote_address":"192.168.89.10","wrap_ttl":0,"headers":{}},"error":""}'
timestamp: 'Jun 13 17:48:21'
hostname: 'ps-vault1'
program_name: 'vault'
log: '{"time":"2018-06-13T15:48:21.697524573Z","type":"request","auth":{"client_token":"","accessor":"","display_name":"","policies":null,"metadata":null,"entity_id":""},"request":{"id":"0db6af6c-65ed-4bbe-71b3-45f759cc5c6f","operation":"update","client_token":"","client_token_accessor":"","path":"auth/ldap/login/marziou","data":{"password":"hmac-sha256:1509bd55629fb62baf8dce9bd3055b53a9204dde7b0dcb79ae126a8c758b03b7"},"policy_override":false,"remote_address":"192.168.89.10","wrap_ttl":0,"headers":{}},"error":""}'
**Phase 2: Completed decoding.
decoder: 'vault'
time: '2018-06-13T15:48:21.697524573Z'
type: 'request'
auth.client_token: ''
auth.accessor: ''
auth.display_name: ''
auth.policies: 'null'
auth.metadata: 'null'
auth.entity_id: ''
request.id: '0db6af6c-65ed-4bbe-71b3-45f759cc5c6f'
request.operation: 'update'
request.client_token: ''
request.client_token_accessor: ''
request.path: 'auth/ldap/login/marziou'
request.data.password: 'hmac-sha256:1509bd55629fb62baf8dce9bd3055b53a9204dde7b0dcb79ae126a8c758b03b7'
request.policy_override: 'false'
request.remote_address: '192.168.89.10'
request.wrap_ttl: '0'
error: ''
**Phase 3: Completed filtering (rules).
Rule id: '1002'
Level: '2'
Description: 'Unknown problem somewhere in the system.'
**Alert to be generated.