Search code examples
splunksplunk-query

Splunk: Entry looks like an array but can't be accessed as one


I've got a portion of a log entry which looks like an array, but I can only access it with the {} notation.

For example, I think the path is line.ul-log-data.meta.data[0].foo, but the only way I can access the value is line.ul-log-data.meta.data{}.foo.

I've been experimenting with various multivalue field evaluations but coming up short. For example, when I do an mvcount("line.ul-log-data.meta.data"), it returns 1.

What do I have to do to use the array notation [0] and get that count to return 2?

screenshot


Solution

  • Splunk uses curly brackets to access JSON arrays because square brackets have a very different, historical function.

    Have you tried mvcount("line.ul-log-data.meta.data{}")?