grok_exporter
grok_exporter copied to clipboard
JSON Webhook Parsing
Thank you for the great tool. I think I've run into a bug with JSON parsing.
I have a JSON object like this being sent to /webhook:
{
"transaction": {
"messages": [
{
"details": {
"info": "this is what I want"
}
}
]
}
I've tried the following configuration but it throws an error the selector path cannot be found:
...
webhook_format: json_single
webhook_json_selector: .transaction.messages[0].details.info
...
I've also tried switching to webhook_format:json_bulk but I can't find a working webhook_json_selector. Any help would be greatly appreciated on how to move forward.
Thanks for reporting. I'll try to look into it over the weekend...
The webhook_json_selector currently does not support array indexes like [0], but it looks like this should be easy to implement if you don't need full jsonpath support. I'll get a simple implementation done that will cover your example above.
I pushed a fix, supporting simple array indexes in webhook_json_selector like in your example above. If you build grok_exporter from source from the master branch it should work now. Thanks for reporting this!