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!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...