Has anyone managed to get the host FQDN ingested into Logstash when running it as a Windows Service via NSSM?
filter {
mutate {
add_field => {
"HostFQDN" => "${COMPUTERNAME}.${USERDNSDOMAIN}"
So this works running \bin\logstash.bat from the command line as both %COMPUTERNAME% and %USERDNSDOMAIN% are env variables accessible from Command Line.
However when \bin\logstash.bat is run as a Service via NSSM it only reads in the ${COMPUTERNAME} variable and not ${USERDNSDOMAIN}. In fact bizarrely it reads in quite a lot of the Windows Env Variables but not all of them, even a couple of 'Standard' Windows variables are not read in e.g. ${LOGONSERVER}.
I tried a work around by creating a separate runme batch file to launch \bin\logstash.bat, but again it only adds both variables when run by itself and if runme.bat is called by the NSSM Windows Service then it can't read the %USERDNSDOMAIN% variable.
Anyone with a cunning idea on how to ingest the host FQDN into Logstash when run as a Service via NSSM?
Seems strange that Logstash itself doesn't read in the FQDN as its own internal variable like it does for "host" which is just the server name.
Thanks