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.

 

Answers ( 2 )

    0
    2020-08-14T07:18:59+05:30

    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 Files\SplunkUniversalForwarder\etc\system\local\inputs.conf” -Raw) -replace ‘( = ).*’, ” = $1$($env:COMPUTERNAME)” | Set-Content “C:\Program Files\SplunkUniversalForwarder\etc\system\local\inputs.conf”

  1. 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 permission to answer to this question .