Getting Data In

Changing the default hostname of Splunk Universal Forwarder

izzie123
Path Finder

Hello All,

I had installed UF on a windows server in our environment which is reporting to our Deployment server, Recently the hostname on it got changed and it stopped reporting to DS.

I referred to this link and tried to run the below commands on CLI:

https://community.splunk.com/t5/Getting-Data-In/How-can-I-change-the-default-hostname-in-Splunk/m-p/...

./splunk set servername foo.domain.com

./splunk set default-hostname foo.domain.com

However, it is not recognizing these commands on the windows CLI .

Error : "'./splunk' is not recognized as an internal or external command,
operable program or batch file."

Can you all kindly help understand what could be the issue? 

I had ran these commands after going to the path where splunk UF is installed and under /etc/system/local/ directory.

But I am still getting this error, I am not sure if I am missing any step, or is it the path error and why these commands are not working.

We do not want to touch the configuration files, we would like to do the changes through CLI itself.

Can someone please help me in understanding the steps needed to be followed.

Thanks a ton in advance.

Labels (3)
0 Karma
1 Solution

SanjayReddy
SplunkTrust
SplunkTrust

Hi @izzie123 

run following command 

cd C:\Program Files\Splunk\bin

splunk show servername

splunk set servername <servername>

splunk set default-hostname <servername>

----
Regards,
Sanjay Reddy

----
If this reply helps you, Karma would be appreciated

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

Understand that Splunk primarily is a  Linux product that also runs on Windows.  Most documentation you will see is written for Linux users.  Windows users need to translate "./splunk" to "splunk.exe".

---
If this reply helps you, Karma would be appreciated.
0 Karma

izzie123
Path Finder

@richgalloway  Thank you for your reply.

I tried running the command "splunk.exe show servername" to check but I am still getting the same error.

Can you help with the command that needs to be run?

Many thanks!

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Documentation assumes you are in the directory where the command resides.  If you aren't then use the commands appropriate for your platform/shell to get to the correct file system location.

---
If this reply helps you, Karma would be appreciated.

SanjayReddy
SplunkTrust
SplunkTrust

Hi @izzie123 

run following command 

cd C:\Program Files\Splunk\bin

splunk show servername

splunk set servername <servername>

splunk set default-hostname <servername>

----
Regards,
Sanjay Reddy

----
If this reply helps you, Karma would be appreciated

Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Thanks for the Memories! Splunk University, .conf25, and our Community

Thank you to everyone in the Splunk Community who joined us for .conf25, which kicked off with our iconic ...

Data Persistence in the OpenTelemetry Collector

This blog post is part of an ongoing series on OpenTelemetry. What happens if the OpenTelemetry collector ...

Introducing Splunk 10.0: Smarter, Faster, and More Powerful Than Ever

Now On Demand Whether you're managing complex deployments or looking to future-proof your data ...