Getting Data In

Split json array of objects into multiple events

sboogaar
Path Finder

We have data structured in the following format:

[
  {
    "container_id": "1",
    "executor_id": "1",
    "framework_id": "2",
    "statistics": {
      "cpus_limit": 1,
      "cpus_nr_periods": 1
    },
    "status": {
      "container_id": {
        "value": "123"
      }
    }
  },
   {
    "container_id": "2",
    "executor_id": "1",
    "framework_id": "3",
    "statistics": {
      "cpus_limit": 1.1,
      "cpus_nr_periods": 2
    },
    "status": {
      "container_id": {
        "value": "124"
      }
    }
  }
]

We would like to split it into seperate events in a way that we end up with:

Event 1

 {
        "container_id": "1",
        "executor_id": "1",
        "framework_id": "2",
        "statistics": {
          "cpus_limit": 1,
          "cpus_nr_periods": 1
        },
        "status": {
          "container_id": {
            "value": "123"
          }
        }
      }

Event 2

{
        "container_id": "2",
        "executor_id": "1",
        "framework_id": "3",
        "statistics": {
          "cpus_limit": 1.1,
          "cpus_nr_periods": 2
        },
        "status": {
          "container_id": {
            "value": "124"
          }
        }
      }

We can not do a split by '},' as this would also split on

"cpus_nr_periods": }, "status": {

Is there any way we can split those events (on index time)

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Assuming your data isn't actually prettyprinted, you can have LINE_BREAKER = \}(,)\{ in your props.conf, alongside SHOULD_LINEMERGE = false. If your data is prettyprinted you'll need to allow whitespace between the comma and the opening curly brace.

martin_mueller
SplunkTrust
SplunkTrust

If your data is prettyprinted you'll need to allow whitespace between the comma and the opening curly brace.

\}(,\s*)\{

sboogaar
Path Finder

It is formatted exactly as I posted. I dont see how the linebreaker would work https://regexr.com/43084. We are not in control of the format as it is a response of a call to a DC/OS api

0 Karma
Get Updates on the Splunk Community!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...