Splunk Enterprise

How to manipulate field values in raw log?

super_saiyan
Communicator

How do i replace the Hyphen with dot.

For example i have a field call IP and the value are 10-20-11-120 but i want to convert this to 10.20.11.120.

I have tried the | rex mode=sed but it's only replacing the first hyphen with dot. Please refer to my below SPL

SPL

| makeresults | eval IP="10-20-11-120"
| rex mode=sed field=IP "s/-/./"

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
| rex mode=sed field=IP "s/-/./g"

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust
| rex mode=sed field=IP "s/-/./g"

richgalloway
SplunkTrust
SplunkTrust

Make the SED operation repeat by using the 'g' flag.

| makeresults | eval IP="10-20-11-120"
| rex mode=sed field=IP "s/-/./g"
---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

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 ...

.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 ...