Getting Data In

Change host name at search time

hartfoml
Motivator

I have a search like this

sourcetype=foo | stats count by host

I have 8 hosts that report to this search and all of them have standard names but one does not.

I get this type of results:

host     count
sys1     20
sys2     25
srv1     40

I want to change the results so that srv1 shows up in the results as sys3.

as always thanks for your help....:-)

Tags (2)
0 Karma
1 Solution

Ayn
Legend

Just rewrite the host value in your search before the stats command.

sourcetype=foo | eval host=if(host=="srv1","sys3",host) | stats count by host

View solution in original post

Ayn
Legend

Just rewrite the host value in your search before the stats command.

sourcetype=foo | eval host=if(host=="srv1","sys3",host) | stats count by host

hartfoml
Motivator

thanks much

0 Karma
Get Updates on the Splunk Community!

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...

Splunk MCP & Agentic AI: Machine Data Without Limits

Discover how the Splunk Model Context Protocol (MCP) Server can revolutionize the way your organization uses ...