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!

Detecting Remote Code Executions With the Splunk Threat Research Team

WATCH NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If exploited, ...

Enter the Splunk Community Dashboard Challenge for Your Chance to Win!

The Splunk Community Dashboard Challenge is underway! This is your chance to showcase your skills in creating ...

.conf24 | Session Scheduler is Live!!

.conf24 is happening June 11 - 14 in Las Vegas, and we are thrilled to announce that the conference catalog ...