I am currently using log4j library in java to post logs onto syslog but those logs always show "localhost" for hostname instead of the device's actual name. This only happens when i send log from my java program. If i use logger to send logs to syslog they show proper FQDN. This is my template:
$template myFormat, "%TIMESTAMP:::date-rfc3339% %HOSTNAME% %msg%\n" $ActionFileDefaultTemplate myFormat
I have also used
$PreserveFQDN on and also tried changing from "%HOSTNAME%" to "%FROMHOST%" in the template and none of these worked. Please help. I don't understand this as i am pretty new to this.