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!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...