JSON Parser
The JSON parser plugin is used to take in a string and extract the fields when they are originally formatted as a JSON object.
Parameters
fields: The keys in the JSON data, separated by commas. For example “session_id,request_type,response_ms”.
accept_batch: OPTIONAL. If requests received may contain a batch of JSON records. NOTE that a batch of json records is NOT the same as a JSON array containing records inside a JSON array. These are independent records followed one by another in the same payload.
This parameter does not require a value. If you pass the parameter, then it’s taken as ‘true’.
Syntax
PARSER json (
fields '<strings separated by comma>'
accept_batch
)
Example
To parse records like…
{
"session_id": "79238746923874",
"request_type" "GET",
"response_ms", 0.23
}
You can use
PARSER json (
fields 'session_id,request_type,response_ms'
)
If the payload can contain multiple JSON records:
PARSER json (
fields 'session_id,request_type,response_ms'
accept_batch
)