Getting Data In

How to configure props.conf to line break data in json format?

jedatt01
Builder

I have events that are coming in 'kinda' json format. I can't get KV_MODE=json to work so I was going to try and do the line breaking and field extraction manually. 2 sample events below. Please help.

{
            "_id" : ObjectId("123456"),
            "notificationId" : 1234567,
            "notificationTime" : "4/9/2014 10:05:41 AM",
            "user" : {
                    "userId" : 1235,
                    "userType" : "New Member",
                    "identifiers" : [
                            {
                                    "identifier" : "123456",
                                    "identifierType" : "Entity Key"
                            },
                            {
                                    "identifier" : "123456",
                                    "identifierType" : "GenKey"
                            }
                    ],
                    "createdOnDate" : "2014-04-02T14:18:49-04:00"
            },
            "devices" : [
                    {
                            "activity" : [
                                    {
                                            "d1" : "0",
                                            "d2" : "0",
                                            "c1" : "0",
                                            "s1" : "0",
                                            "day" : "4/8/2014 12:00:00 AM"
                                    },
                                    {
                                            "d1" : "0",
                                            "d2" : "0",
                                            "c1" : "0",
                                            "s1" : "0",
                                            "day" : "4/9/2014 12:00:00 AM"
                                    }
                            ],
                            "deviceId" : "1234567"
                    }
            ],
            "__v" : 0
    },

{
            "_id" : ObjectId("123456"),
            "notificationId" : 1234567,
            "notificationTime" : "4/9/2014 10:05:41 AM",
            "user" : {
                    "userId" : 1235,
                    "userType" : "New Member",
                    "identifiers" : [
                            {
                                    "identifier" : "123456",
                                    "identifierType" : "Entity Key"
                            },
                            {
                                    "identifier" : "123456",
                                    "identifierType" : "GenKey"
                            }
                    ],
                    "createdOnDate" : "2014-04-02T14:18:49-04:00"
            },
            "devices" : [
                    {
                            "activity" : [
                                    {
                                            "d1" : "0",
                                            "d2" : "0",
                                            "c1" : "0",
                                            "s1" : "0",
                                            "day" : "4/8/2014 12:00:00 AM"
                                    },
                                    {
                                            "d1" : "0",
                                            "d2" : "0",
                                            "c1" : "0",
                                            "s1" : "0",
                                            "day" : "4/9/2014 12:00:00 AM"
                                    }
                            ],
                            "deviceId" : "1234567"
                    }
            ],
            "__v" : 0
    },
0 Karma

Damien_Dallimor
Ultra Champion

Have you tried to set the sourcetype to _json ? (this sourcetype definition ships with Splunk)

0 Karma

jedatt01
Builder

Yes, but it did not work. Looks like this is not 100% correct json and the kv_mode=json won't recognize it. I'm working with the data provider to see if they can correct the issue

0 Karma

Sanjai676
Path Finder

I'm experiencing same issue. Have you got any results?

0 Karma

jrodman
Splunk Employee
Splunk Employee

I'm no json expert. Normally for json in splunk you want to arrange for your events to be valid complete json items, whether that's a the entirety of the original json document, or a subcomponent.

This typically is more of a question of "how can I get splunk to keep this component of my json blob as an event", where linebreaking is how to identify a unit of information in a file. Typically linebreaking just identifies lines, and event merging combines them to form events. There are times where "abusing" linebreaking to make each line an event may be easier to configure though.

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!

Free Professional Services for .conf26 Attendees

This year at .conf26, we are doing something a little different. We are bringing the best minds from ...

Defend at Machine Speed: Your Guide to Security Sessions at .conf26

Splunk .conf26   With threats moving at machine speed and attack surfaces expanding across hybrid ...

Where Innovation Takes Flight: The Splunk4Aviation Flight Sim Lands at .conf26

If you hear someone at .conf26 shouting "gear down, GEAR DOWN" across the show floor, you have found us.  The ...