In my template, I have %hostname% to make the host show up in the lines written to /var/log/messages. On the server in question, there are logs from remote hosts as well as ones that are locally generated. For the logs that are locally generated, sometimes the host field in the entries in /var/log/messages shows up as my actual host name, like "serverFoo", and other times it shows up as "localhost". Sometimes when rsyslog is behaving one way, a service restart will flip it to the other way. For locally generated log messages, what does rsyslog do to fill in the %hostname% property? How does it decide how to fill in this string, and why does it change its mind sometimes about how to do so?
I am running rsyslog 4.4.2.
-John

