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 as Code: From Zero to Dashboard

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

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Shape the Future of Splunk: Join the Product Research Lab!

Join the Splunk Product Research Lab and connect with us in the Slack channel #product-research-lab to get ...