my application logs everyday a json containing a map for a Pie chart.
For example this JSON:
{
"telemetryEventName": "active-deliveries",
"telemetryData": [
{
"id": "1",
"name": "repo-01",
"gitTextsInformation": [
{
"key": "es-ES",
"value": "47"
},
{
"key": "pt-BR",
"value": "46"
}
]
},
{
"id": "2",
"name": "repo-02",
"gitTextsInformation": [
{
"key": "es-ES",
"value": "12"
},
{
"key": "pt-BR",
"value": "13"
}
]
}
]
}
It cames from a log message, and I'd like to create a Pie chart for each gitTextsInformation
I already tried to create a table:
"index"="main" "kubernetes.container_name"="..." logger_name=telemetryLogger message.telemetryEventName="..."
| head 1
| table message.telemetryData{}.gitTextsInformation{}.key message.telemetryData{}.gitTextsInformation{}.value
But it is not working as a search for creating the Pie chart

The problem is there is only one event, which makes for an uninteresting pie chart. Yes, there are multiple data points in that event, but Splunk cannot plot multi-value fields. The workaround is to put each data point into its own event.
The
mvexpandcommand will break a multi-value field into multiple events, but it only works with one field. Usingmvexpandon one field and then another breaks the association between the fields. To maintain the relationship between keys and values, we first have to combine them into a single field, runmvexpand, then separate the keys and values.