Logscape Support

Members Login
Username 
 
Password 
    Remember Me  
Post Info TOPIC: Automatically configure the Logscape _Dnet-iface parameter


Veteran Member

Status: Offline
Posts: 41
Date:
Automatically configure the Logscape _Dnet-iface parameter
Permalink  
 


A useful bit of code if you're automating deployments.

Use Case: A forwarder with multiple network cards. If you want to force Logscape to use a certain LAN for example, you have to set the -Dnet.iface parameter with the ETH device number - which on Windows Hosts is found using the NetworkList.bat script found in the scripts folder.

This PowerShell simply runs that script, compares it to the LAN name you wish to use and then sets the value in the boot.properties file.

Text in red should be altered for your deployment: which NetAdapter you want as well as the Logscape path.

Thanks to Ben Gelens for this!

 

$NIC = Get-NetAdapter -Name 'Server LAN'
                Push-Location -Path 'D:\Program Files\logscape\scripts\ (file:///D:/Program%20Files/logscape/scripts/)'
                $JavaEnumInt = & '.\networkList.bat'
                $ETH = ($JavaEnumInt | Select-String -Pattern "$($nic.InterfaceDescription) /").ToString().Split('/')[0]

                $bootconfig = Get-Content 'D:\program files\logscape\boot.properties (file:///D:/program%20files/logscape/boot.properties)' | %{
                    if ($_ -match 'sysprops=-') {
                        $_.replace($_, "$_ -Dnet.iface=$ETH")
                    }
                    elseif ($_ -match '#priority=LOW') {
                        $_.replace($_, $_.trimstart('#'))
                    }
                    else {
                        $_
                    }
                }
                $bootconfig | Set-Content 'D:\program files\logscape\boot.properties (file:///D:/program%20files/logscape/boot.properties)' -Force
                Restart-Service -Name 'Logscape Agent' -Force

 



__________________

Excelian - GitHub

Page 1 of 1  sorted by
 
Quick Reply

Please log in to post quick replies.



Create your own FREE Forum
Report Abuse
Powered by ActiveBoard