Getting Data In

How can I remove some parenthesis from this log?

daniel333
Builder

All,

I am trying to convert some superfluous parenthesis from this log. Duration value can be up to 4 digits.

Looks like
1/2/2017 12:34 severity=INFO post call (duration=5)

What I want
1/2/2017 12:34 severity=INFO post call duration=5

Here is what I got so far, but not clicking.
SEDCMD-log4jwild_fix_duration_parenth = s/((duration=(0-9)*))/\1/

Any ideas?

0 Karma

mayurr98
Super Champion

Try this run anywhere search, below will look only for duration fieldand remove the brackets from duration field only.

| makeresults 
| eval data="1/2/2017 12:34 severity=INFO post call (duration=5)" 
| rex field=data mode=sed "s/\((duration=[^\)]+)\)/\1/"

Here is what you should write in your environment:

SEDCMD-log4jwild_fix_duration_parenth = s/\((duration=[^\)]+)\)/\1/

let me know if this helps!

0 Karma

ddrillic
Ultra Champion

What about a sed command which would replace either ( or ) with nothing?

0 Karma

493669
Super Champion

have you tried below answer.. it will remove ( and )

0 Karma

493669
Super Champion

Try this:

SEDCMD-log4jwild_fix_duration_parenth = s/([^\(]+)\(([^\)]+)\)/\1\2/
0 Karma
Get Updates on the Splunk Community!

Data Management Digest – December 2025

Welcome to the December edition of Data Management Digest! As we continue our journey of data innovation, the ...

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 ...