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!

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...