Splunk Search

[Help] Renaming field of a specific source

Zyon
Engager

Hi,

I am using multiple sources in a single search command and i want to rename the _raw field of one of the source type.

My current search:

sourcetype="blacklisted ip" OR sourcetype="log" | rename _raw as blacklisted

I want to change the _raw field of blacklisted ip into blacklisted, and leave the _raw field of log as default.

Thanks a lot.

Tags (1)
0 Karma
1 Solution

gkanapathy
Splunk Employee
Splunk Employee
sourcetype="a" OR sourcetype="b" | eval blacklisted=if(sourcetype=="a",_raw,null())

View solution in original post

gkanapathy
Splunk Employee
Splunk Employee
sourcetype="a" OR sourcetype="b" | eval blacklisted=if(sourcetype=="a",_raw,null())

linu1988
Champion

If you want to get rid of the data of the specific sourcetype please use the transforms.conf file to null queue... And yes you can rename the _raw field as well, but its temporary.

0 Karma
Get Updates on the Splunk Community!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...