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!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk, and empower your SOC to reach new heights! Duration: 1 hour  Prepare to ...

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...