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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...