Splunk Search

Correlate data in JSON file without timestamp

Patrick_Peeters
Splunk Employee
Splunk Employee

I have a JSON input with different types, all representing a data point at a certain time. I have the start time of the event and am looking for a way to get all the data organised without having to revert to custom Python code - how do I do this?

The 'time' type in JSON depicts how many seconds since the start time a data point is happening across all these types.

Ideally I'm looking for something that looks like this based on the data below assuming the start time is 12:00:00, probably latlng even split but that's secondary for now:

_timedistancealtitudelatlng
12:00:003.851.5
-33.895627151.228228
12:00:015.251.6-33.895627151.228228
12:00:036.751.5-33.895627151.228228
12:00:048.951.5-33.895627151.228228

 

 

[
    {
        "type": "time",
        "data": [
            0,
            1,
            3,
            4
        ]
    }, 
    {
        "type": "distance",
        "data": [
            3.8,
            5.2,
            6.7,
            8.9
        ]
    },
    {
        "type": "altitude",
        "data": [
            51.5,
            51.6,
            51.5,
            51.5
        ]
    },
    {
        "type": "latlng",
        "data": [
            [
                -33.895627,
                151.228228
            ],
            [
                -33.895627,
                151.228228
            ],
            [
                -33.895627,
                151.228228
            ],
            [
                -33.895627,
                151.228228
            ],
        ]
    },
]

 

 

 

0 Karma
1 Solution

Patrick_Peeters
Splunk Employee
Splunk Employee

Managed to get it done via Python's pandas module, specifically pandas.DataFrame function. It works great for series and dataframe data like the one I had.

The result:

 

[
    {
        "time": 1580539600,
        "distance": 0,
        "altitude": 45.7,
        "heartrate": 77,
        "lat": -33.895302,
        "lon": 151.228177
    },
    {
        "time": 1580539601,
        "distance": 0,
        "altitude": 45.7,
        "heartrate": 77,
        "lat": -33.895302,
        "lon": 151.228177
    },
    {
        "time": 1580539602,
        "distance": 0,
        "altitude": 45.7,
        "heartrate": 77,
        "lat": -33.895325,
        "lon": 151.22817
    }
]

 

 

View solution in original post

Tags (3)
0 Karma

Patrick_Peeters
Splunk Employee
Splunk Employee

Managed to get it done via Python's pandas module, specifically pandas.DataFrame function. It works great for series and dataframe data like the one I had.

The result:

 

[
    {
        "time": 1580539600,
        "distance": 0,
        "altitude": 45.7,
        "heartrate": 77,
        "lat": -33.895302,
        "lon": 151.228177
    },
    {
        "time": 1580539601,
        "distance": 0,
        "altitude": 45.7,
        "heartrate": 77,
        "lat": -33.895302,
        "lon": 151.228177
    },
    {
        "time": 1580539602,
        "distance": 0,
        "altitude": 45.7,
        "heartrate": 77,
        "lat": -33.895325,
        "lon": 151.22817
    }
]

 

 

Tags (3)
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...

SplunkTrust Application Period is Officially OPEN!

It's that time, folks! The application/nomination period for the 2026-2027 SplunkTrust is officially open. If ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...