Splunk Search

Why is my regex for SEDCMD in props.conf not removing repeated dashes when parsing data?

daniel333
Builder

My developers are adding dashes --- in their logs all over. Sometimes 1.. sometimes 10 dashes. Makes them look really ugly in Splunk. Hoping to remove them using SEDCMD. Any idea why this isn't working?

SEDCMD-fixdash=s/[-]*/-/g

thanks,
-Daniel

0 Karma

s2_splunk
Splunk Employee
Splunk Employee

If they are your developers, make them stop doing that stuff and log JSON instead. 😉

s2_splunk
Splunk Employee
Splunk Employee

Try SEDCMD-fixdash=s/-+/-/g
Dash is not a RegEx special character, so no character class needed. '+' means 'one or more'.

Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...