Splunk Search

How to display a custom field with underscore from search result

splunkrocks2014
Communicator

For instance, how to show "_msg" from the search result? Thanks.

| makeresults
| eval _msg="Hello World"
Tags (1)
0 Karma

elliotproebstel
Champion

You can rename the field to not start with an underscore, and then Splunk will display it:

| makeresults
| eval _msg="Hello World"
| rename "_msg" AS "msg"

If you have many fields that start with underscores, you could do this:

| makeresults
| eval _msg="Hello World"
| rename "_*" AS "*"

Note that this will also display and convert other internal fields, like _time.

elliotproebstel
Champion

If you are wondering why you need to rename them at all, it's because Splunk uses underscores to identify internal fields:

https://docs.splunk.com/Splexicon:Internalfield
http://docs.splunk.com/Documentation/SplunkCloud/7.0.0/Knowledge/Usedefaultfields

Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

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

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...