The JSON path value from HTTP API input reads any JSON response of a REST resource and stores a field value as a Graylog message.
Hint: The input can only target JSON primitive value nodes (numbers, text, strings, etc.) and not object and array nodes.
Navigate to System / Inputs > Inputs and select Launch JSON path value from HTTP API. Then click Launch Input, set the significant field values, and save the input.
source = github ,jsonpath = $.download_count, interval time unit = Minutes
Let’s try to read the download count of a release package stored on GitHub for analysis in Graylog. The call looks like this:
$ curl -XGET https://api.github.com/repos/YourAccount/YourRepo/releases/assets/12345
The attribute we want to extract is
download_count so we set the JSON path to
This will result in a message in Graylog looking like this:
You can use Graylog to analyze your download counts now.
JSONPath can do much more than allow you to select a simple known field value. You can for example do this to select the first
download_count from a list of releases where the field
state has the value
$.releases[?(@.state == 'uploaded')].download_count
...or only the first download count at all:
You can learn more about JSONPath here.