Splunk “Inputs.config” file change request based on NETBIOS NAME.

Question

Hello Team,

Greetings for the day. Once again i am stuck on one project for which i need your help. “Our TAG line says no question is silly question” so i dare to ask this one :).
I have one requirement to change one Splunk Configuration File located at “C:Program FilesSplunkUniversalForwarderetcsystemlocal” file name Inputs.config.

This is the data in the file if we open with notepad

[default]
host = OLDNAME

I want to read the NETBIOS name of the server and change OLDNAME to actual server name. So if my server name is HTMD.com then i need the entry to replace OLDNAME with HTMD.com.
Not restricting myself with options so BAT script, PS, Application, Package, Configuration Item, from SCCM or without SCCM. All options are welcome.

 

solved 0
Deepak Rai 2 months 2 Answers 45 views Admin 0

Answers ( 2 )

  1. Me too Sir. I was trying my luck if anyone writes then i will be saved.

    Had to write one liner. Tested and worked Sir.

    (Get-Content “C:Program FilesSplunkUniversalForwarderetcsystemlocalinputs.conf” -Raw) -replace ‘( = ).*’, ” = $1$($env:COMPUTERNAME)” | Set-Content “C:Program FilesSplunkUniversalForwarderetcsystemlocalinputs.conf”

  2. The best is to use CI and script to check the name and change the name if it’s not as per the requirement

    Unfortunately I don’t have script to do this as you know I don’t like coding

    Best answer
    Cancel the best answer

Leave an answer

Sorry, you do not have a permission to answer to this question .