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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...