Splunk Search

After I have changed the name of a host, how can I show two host names as one name?

jeremeek
Explorer

I fixed the name of a host on the forwarder. It was showing as "hostname.domain.com" instead of just "hostname". I fixed the name and restarted the Splunk service.

Now i have 2 different host names showing in Splunk up for the same host. How could i show all of the "hostname.domain.com" data as "hostname" also?

0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

At first, verify in the a period after you changed hostname because old events aren't affected by the change.
In addition, where you fixed hostname? you had to do this in two points:

  • $SPLUNK_HOME/etc/system/local/server.conf
  • $SPLUNK_HOME/etc/system/local/inputs.conf

Bye.
Giuseppe

View solution in original post

gcusello
SplunkTrust
SplunkTrust

At first, verify in the a period after you changed hostname because old events aren't affected by the change.
In addition, where you fixed hostname? you had to do this in two points:

  • $SPLUNK_HOME/etc/system/local/server.conf
  • $SPLUNK_HOME/etc/system/local/inputs.conf

Bye.
Giuseppe

jeremeek
Explorer

i didn't update the server.conf. After i did that and restarted the forwarder the indexer picked it up and all of the old data is searchable by "hostname" now. Thanks

0 Karma

sundareshr
Legend

Try this

... | rex field=host "^(?<host>\w+)" | ...
0 Karma

dbcase
Motivator

tag or an alias is the easiest but if you want to do it in a search then try this

{search}|eval host=if(host=hostname.domain.com,{corrected hostname},host)

0 Karma

cmerriman
Super Champion

try creating a tag or alias? it won't change the raw data, but it'll help you search the data easier?

http://docs.splunk.com/Documentation/Splunk/6.5.0/Knowledge/Abouttagsandaliases

0 Karma

skoelpin
SplunkTrust
SplunkTrust

After making the changes, it will not change the hostname retroactively, so anything indexed before making the changes will remain the same. If you don't like this, you can remove the data and reindex it with your updated hostname

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Take Action Automatically on Splunk Alerts with Red Hat Ansible Automation Platform

 Are you ready to revolutionize your IT operations? As digital transformation accelerates, the demand for ...

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...