Splunk Search

How do I remove specific characters from a string?

joachimroshan
New Member

For example, I have a string "agreementinquiry-web-2.0.3". My result should only have "agreementinquiry".

Tags (1)
0 Karma

skoelpin
SplunkTrust
SplunkTrust

If you want to remove it at search time, then you can use sed to help

| rex mode=sed "s/agreementinquiry\S+/agreementinquiry/g"

It follows the format as Replace/<REGEX_TO_CAPTURE>/<REGEX_TO_REPLACE>/global

If you want to remove it at index time, you should use SEDCMD

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...