Splunk Search

How do you discard specific fields and keep the rest?

rakeshksingh
New Member

Hi All,

Could you please let me know how to discard specific fields and keep the rest while indexing in Splunk ?

like
field 1=a
field 2 =b
field 3 = c
field 4 =d

Fields 1-3 have to be discarded and only field 4 needs to be shown in Splunk events /_raw

Thanks
Rakesh Singh

0 Karma

FrankVl
Ultra Champion

So you just want to strip of that timestamp part? I'm a little curious as to why, but still, try this in props.conf:

[kafka:topicEvent]
SEDCMD-striptimestamp = s/,"time":\d+//

https://regex101.com/r/Ecb0rZ/1

NOTE: SEDCMD takes place at indextime, but after timestamping happens, so if you use that timestamp to populate _time, that would still work.

0 Karma

FrankVl
Ultra Champion

If you want to modify your raw events (and as a result also the fields that get extracted from those at searchtime), the SEDCMD in props.conf is usually the best option.

Can you share some sample raw events and an example of the desired output? Then we can sure help you with that.

0 Karma

rakeshksingh
New Member

added the sample logs and requirement

0 Karma

493669
Super Champion

Hi @rakeshksingh,
Go through this document to Discard specific events and keep the rest
http://docs.splunk.com/Documentation/Splunk/latest/Forwarding/Routeandfilterdatad#Filter_event_data_...

0 Karma

rakeshksingh
New Member

It will be discarding specific events but not fields of that event.

sample logs :-

{"message":" 2017-06-12 08:32:30,585 INFO main org.apache.coyote.ajp.AjpNioProtocol - Initializing ProtocolHandler [\"ajp-nio-8009\"]","time":1497256350}

https://answers.splunk.com/storage/temp/205746-kafkadocker.jpg alt text

So i need only message fields

0 Karma

harishalipaka
Motivator

hi @rakeshksingh

try like this ..

index=summary_data where field=4
Thanks
Harish
0 Karma

rakeshksingh
New Member

thanks for query but it all the fields are in one raw event

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...