LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   after hostname change, syslogd still output previous hostname to messages file (http://www.linuxquestions.org/questions/linux-general-1/after-hostname-change-syslogd-still-output-previous-hostname-to-messages-file-741607/)

tiger2000 07-21-2009 02:33 AM

after hostname change, syslogd still output previous hostname to messages file
 
Dear All,

We're running two servers : CentOS 4.4 and RedHat ent. 5.1, both of them have same issues :

after we change to another hostname, the syslog (/var/log/messages) still keeps the previous hostname.

the way we're change hostname are :
/etc/hosts
/etc/sysconfig/network
service network restart
(actually, we've reboot this server several times)

but we still found the log messages are still in previous hostname. (in /var/log/messages)

any advice on this? Thanks.

jhwilliams 07-21-2009 02:49 AM

Code:

root@salmon:~#echo "foo" > /etc/hostname
root@salmon:~#hostname
foo
root@salmon:~#echo "bar" > /etc/hostname
root@salmon:~#hostname
bar


Tinkster 07-21-2009 03:20 AM

Quote:

Originally Posted by tiger2000 (Post 3614814)
the way we're change hostname are :
/etc/hosts
/etc/sysconfig/network
service network restart
(actually, we've reboot this server several times)

but we still found the log messages are still in previous hostname. (in /var/log/messages)

any advice on this? Thanks.

I hope you're not expecting historical lines in the
logs to change the hostname entry? That won't happen.



Cheers,
Tink

tiger2000 07-22-2009 09:36 PM

I've fingure out the reason, and it looks like I should take this action before 'service syslog restart' .

echo "my.new.host.name" > /proc/sys/kernel/hostname

there's `hostname my.new.host.name` command seems doing the same thing.

Thanks.


All times are GMT -5. The time now is 04:05 AM.