Closed devasmith closed 1 year ago
Although I don't see any problem adding a json output to MatchedRules, I do see a problem adding additional configuration to connectors. Logs are already too complicated for users, we have error, audit and debug, now we would add error log configurations IMHO it's better if each user parses the coraza lot as it is, then he can transform it into json
I don't quite understand connectors in this context but I assume it apps that use coraza as a library.
Would it be the right place to add a json formatter here based on a config flag? Don't know if this also is considered a connector or is there a better place to put json logging on the application side.
+1 to custom serializers, -1 to adding log level to the config. As of now you can configure that in the seclang config, supporting log config somewhere else will be problematic and cumbersome as you need to define a priority that users need to be aware of and still that does not clarify anything.
+1 to custom serializers, -1 to adding log level to the config. As of now you can configure that in the seclang config, supporting log config somewhere else will be problematic and cumbersome as you need to define a priority that users need to be aware of and still that does not clarify anything.
Can you give any example configurating this via seclang? Is it something we would have to define here?
check https://coraza.io/docs/seclang/directives/#secdebuglog
On Thu, Sep 7, 2023 at 9:02 AM Anders Smith @.***> wrote:
+1 to custom serializers, -1 to adding log level to the config. As of now you can configure that in the seclang config, supporting log config somewhere else will be problematic and cumbersome as you need to define a priority that users need to be aware of and still that does not clarify anything.
Can you give any example configurating this via seclang? Is it something we would have to define here https://github.com/corazawaf/coraza/blob/main/coraza.conf-recommended?
— Reply to this email directly, view it on GitHub https://github.com/corazawaf/coraza-spoa/issues/91#issuecomment-1709586929, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXOYAXIGHFMQLKRNLLSFNTXZFWPPANCNFSM6AAAAAA4NXHEYQ . You are receiving this because you commented.Message ID: @.***>
check https://coraza.io/docs/seclang/directives/#secdebuglog …
I don't really get it. How can we use this? Is this a replacement for the logging at https://github.com/corazawaf/coraza-spoa/blob/main/config.yaml.default#L29-L32?
I don't quite understand connectors in this context but I assume it apps that use coraza as a library.
Yup, you're right.
Is this a replacement for the logging at https://github.com/corazawaf/coraza-spoa/blob/main/config.yaml.default#L29-L32?
Of course, no :)
Should be something like that on coraza's side for Debug and Error logs, I think.
@devasmith, while your hack works for Coraza's error log, I would like to attract attention to Connector's logs as well as other libraries.
I just noticed this change: https://github.com/corazawaf/coraza-spoa/pull/90/files#diff-d0effb22dac9e11bf39bf7ede9c5a9802da85a46a39fe39fe2c81fec1a3ddda6R22-R23
This is what I was after and it seems to be implemented in that draft.
Oh, OK. I guess I won't say anything about #90. Wish you luck 🤝
Summary
It would be nice if we could log these events as json so that for example Kibana can digest them in that format. Other logs are consumed in this way and it would be good to follow the same standard if possible. I discussed this briefly with @jptosso on the OWASP Slack.
Basic example
Maybe we can add a option so that we can change the log format https://github.com/corazawaf/coraza-spoa/blob/main/config.yaml.default#L29-L32
Example:
I got referred to this block https://github.com/corazawaf/coraza-spoa/blob/6a0d9a3ba67379892eafa105c636d85016f8ef21/internal/spoa.go#L126 as it would be good to implement this feature here.
The current output that needs to be converted can look like this:
We could for example add the following to
rule_match.go
. Did some testing earlier.Test run
Motivation
Having logs in json is great and it is easy to parse.