All Apps and Add-ons

How to parse JSON (blob) data by time stamp AND clean up the trailing brackets and commas?

Log_wrangler
Builder

So I am using this stanza in my .../local props.conf

[mscs:storage:blob]
SHOULD_LINEMERGE = true
LINE_BREAKER: (,[\r\n]+\s+){
TRUNCATE = 0
KV_MODE = json

This works fine to parse my events like this

"time": "2018-07-09T16:14:21.3832528Z",
             "resourceId": "blah",
             "operationName": "blah blah",
             "category": "blah",
             "resultType": "blah",
             "resultSignature": "blah",
             "durationMs": 1234,
             "callerIpAddress": "x.x.x.x",
             "correlationId": "x-x-x-x-x",
             "identity": {"blah blah":{"blah"}},
             "level": "blah",
             "location": "blah",
             "properties": {"statusCode":"OK","serviceRequestId":"x-x-x"}
        }
    ]
}

OR

"time": "2018-07-09T16:14:21.3832528Z",
             "resourceId": "blah",
             "operationName": "blah blah",
             "category": "blah",
             "resultType": "blah",
             "resultSignature": "blah",
             "durationMs": 1234,
             "callerIpAddress": "x.x.x.x",
             "correlationId": "x-x-x-x-x",
             "identity": {"blah blah":{"blah"}},
             "level": "blah",
             "location": "blah",
             "properties": {"statusCode":"OK","serviceRequestId":"x-x-x"}
                }
        ,
        {

Does anyone know how to drop the brackets and commas?

Thank you

0 Karma

jconger
Splunk Employee
Splunk Employee

For JSON in a blob, these props.conf setting work pretty well for most use cases:

[sourcetype]
LINE_BREAKER = \}([\r\n]\s*,[\r\n]\s*)\{
SEDCMD-remove_header = s/\{\s*\"records\"\:\s*\[\s*//g
SEDCMD-remove_footer = s/\][\r\n]\s*\}.*//g
SHOULD_LINEMERGE = false
KV_MODE = json
TIME_PREFIX = time\":\"

Log_wrangler
Builder

Thank you for the reply, I will give it a try and let you know.

0 Karma

coccyx
Path Finder

Where is this from? This is pretty printed JSON data, it would be easier to fix the source to send JSON as single line events.

0 Karma

Log_wrangler
Builder

They are log files send to blob to be pulled into Splunk and ingested. Unfortunately I don't have access to the source to send in a perfect format.

Do you know a way to discard the brackets and commas?

0 Karma

coccyx
Path Finder

Do you have a sample of the full log, not how Splunk parsed it?

We need to see how multiple events look.

0 Karma

Log_wrangler
Builder

Unfortunately I don't have access to the source logs, and probably would not be able to post the original without redacting a lot of sensitive info.

What I do know is that some of the events in the blob are Azure WAF logs.

Would you be able to use that as a source sample?

Here is a link that has a number of the sample json logs
https://docs.microsoft.com/en-us/azure/application-gateway/application-gateway-diagnostics

I appreciate your efforts.
thank you

0 Karma
Get Updates on the Splunk Community!

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...

Splunk MCP & Agentic AI: Machine Data Without Limits

Discover how the Splunk Model Context Protocol (MCP) Server can revolutionize the way your organization uses ...