Splunk Search

Regex in transform.conf delete text in the middle

Alwiinie
New Member

I'm having some trouble to delete the text in "plugin_set".

Sample Incoming data:

 {"plugin_family": "somestuff", "policy": "somsestuff2", "plugin_set": "10026;10111;10150;10170;10183;", "pokemon": "somsestuff3"}

Sample what I want:

 {"plugin_family": "somestuff", "policy": "somsestuff2", "plugin_set": "", "pokemon": "somsestuff3"}

This the closest that I got:

REGEX = (.*)("plugin_set".*\,)
DEST_KEY = _raw
FORMAT = $1 nullQueue

I also tried this, but that showed everything.

REGEX = (.*)("plugin_set".*\,)(.*)
DEST_KEY = _raw
FORMAT = $1 nullQueue $3

What is the right regex string for deleting the text in "plugin_set"?

Tags (2)
0 Karma

somesoni2
Revered Legend

Try this in transforms.conf at indexer/heavy forwarder (assuming you're taking care of props.conf changes already)

REGEX = ^(.+\"plugin_set\"\:\s*\")([^\"]+)(\".+)
DEST_KEY = _raw
FORMAT = $1$3
0 Karma

Alwiinie
New Member

It doesn't work this also showed everything. I don't know if need to change the props.conf more then I now have.
This what I currently have:
tansform.conf:
[removepluginset]
REGEX = ^(.+\"plugin_set\":\s*\")([^\"]+)(\".+)
DEST_KEY = _raw
FORMAT = $1$3

props.conf
[host::hostname]
TRANSFORMS-set = removepluginset

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Try this.

REGEX = (.*"plugin_set":\s")([^,]+)(",.*)
DEST_KEY = _raw
FORMAT = $1$3
---
If this reply helps you, Karma would be appreciated.
0 Karma

Alwiinie
New Member

It doesn't work, it just shows the all the data.

Btw in the props.conf I use this

TRANSFORMS-set = removepluginset
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Are you restarting Splunk after each change to the config files?

---
If this reply helps you, Karma would be appreciated.
0 Karma

Alwiinie
New Member

Yes, after every change in transform.conf I restart Splunk.

0 Karma
Get Updates on the Splunk Community!

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

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...