Splunk Search

How do you store field names as values in a new field based on presence of that field?

mpatel11
Explorer

Say I have 100 rows of logs. Some have only field "abcXYZ1" and not the other two. Some have field "abcKLM" and not the other two and so on...

So occurrence of fields "abc*" is mutually exclusive.

Now based on this, I want to add another field EVENT which will look if that log has field "abcXYZ1" then value of EVENT = abcXYZ1, if a log has field "abcKLM" then EVENT=abcKLM and so on...

So looking at a log and finding which type of field it has based on "abc*" , only that fields name will be stored as a value in the new field EVENT.

Hope it is clear to understand.

Tags (2)
0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust
0 Karma

mpatel11
Explorer

Updates answer also works like a charm. Thanks for the help..

0 Karma
Get Updates on the Splunk Community!

Upcoming Webinar: Unmasking Insider Threats with Slunk Enterprise Security’s UEBA

Join us on Wed, Dec 10. at 10AM PST / 1PM EST for a live webinar and demo with Splunk experts! Discover how ...

.conf25 technical session recap of Observability for Gen AI: Monitoring LLM ...

If you’re unfamiliar, .conf is Splunk’s premier event where the Splunk community, customers, partners, and ...

A Season of Skills: New Splunk Courses to Light Up Your Learning Journey

There’s something special about this time of year—maybe it’s the glow of the holidays, maybe it’s the ...