Splunk Search

How to replace column values in a CSV with static text?

harshal_chakran
Builder

Hi,
I have a CSV file as shown below:

PARAMETER   VALUE
param1       val1
param4     val2
param2     val3
param1     val4
param7     val5
param2       val6

I want to replace all the values inside column named "PARAMETER" with text "common", so whatever values comes inside column "PARAMETER", it should be changed with text "common", Like below:

PARAMETER   VALUE
common     val1
common     val2
common     val3
common     val4
common     val5
common     val6

Please Help...!!!

Tags (4)
1 Solution

somesoni2
Revered Legend

Options

1) Indextime - REX CMD - props.conf on Indexer/Heavy Forwarder

 [yoursourcetype]
...current configurations...
SEDCMD-staticparam = s/([^,]+),(.*)/common,\2/g

2) Search Time - Calculated fields

[yoursourcetype]
...current configurations...
EVAL-PARAMETER = "common"

View solution in original post

somesoni2
Revered Legend

Options

1) Indextime - REX CMD - props.conf on Indexer/Heavy Forwarder

 [yoursourcetype]
...current configurations...
SEDCMD-staticparam = s/([^,]+),(.*)/common,\2/g

2) Search Time - Calculated fields

[yoursourcetype]
...current configurations...
EVAL-PARAMETER = "common"
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

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

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...