@sspaink or other parsing expert . . .
My JSON array consists of about 50 objects each having a different set of between 10-30 name-value pairs. I want to extract specific metrics across the whole array. These metrics are only found in some of the array elements - those that have one (or more) common key-values. The approach so far is to use the pattern matching query in [[inputs.file.json_v2.object]] (i.e., path = “target pattern”) to get only those elements that contain the measurement. Note: the pattern to match on is not the same as the measurement because that measurement might exist in other array elements that should not be included in this metric. E.G., There are blue and red socks, so I match on the color and then extract the count of each.
I can extract the raw measurement using ‘included_keys = [ ]’ or ‘tags = [ ]’, but having tried several variations of subtables, I can’t yet rename tags or change the type of values. And I need to do both.
If the pattern matching approach can do all this, then I welcome any help that can get me pointed towards a solution. However I’ve also been looking into the ‘optional=true’ examples which parse the whole array and suppress errors if the configured path doesn’t match a particular array element. I’d prefer the first approach because I know I’m getting only those array elements that have the measurement of interest.