You are not logged in.

#1 2011-09-02 08:04:47

k6b
Member
From: Austin, TX
Registered: 2011-03-05
Posts: 7

/etc/hosts

I guess this belongs here, if not, mods, I apologize :)

I set up a Centos server and was browsing logfiles and noticed that instead of the usual 'localhost' string that I see in my Arch logs it had my hostname in all of the log files. After a little digging I found this on the Debian forum. I've edited my /etc/hosts how the post describes and lo and behold, after restarting syslog-ng, I get my pretty hostname in my logs. My question is, this runs contrary to how the Beginners Guide directs to set up that file and contrary to how the Arch installer sets up /etc/hosts. Did I just mess something up or is this an oversight? I didn't want to go editing wiki pages not knowing for sure. It seems like everything is running just fine on my machine now.

For reference, here is how my /etc/hosts was:

127.0.0.1   localhost.localdomain   localhost archdesk

This is how it is now

127.0.0.1   archdesk   localhost

Thanks.

Offline

#2 2011-09-02 11:12:02

FarmerF
Member
From: Netherlands
Registered: 2009-06-08
Posts: 76

Re: /etc/hosts

The hosts file has three parts on each line. First is the ip, second the canonical (full) hostname and the third part is an optional list of aliases. In your old situation this means that the first alias (which was used for the logfile) was localhost.

With either:

127.0.0.1   localhost.localdomain   archdesk localhost

or:

127.0.0.1   archdesk.localdomain   archdesk localhost 

I would expect you get the desired behaviour (not 100% sure though).

Read

man hosts

to learn more.

Offline

#3 2011-09-02 11:19:41

lukaszan
Member
Registered: 2011-05-05
Posts: 117

Re: /etc/hosts

The new version is incorrect. I don't think it's going to cause any immediate problems, though.

localhost should point to your loopback address
archdesk can point to your interface address (192.168.0.1 or whatever it is)

Offline

#4 2011-09-02 11:58:10

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,092

Re: /etc/hosts

do something like

127.0.0.1		localhost.localdomain	localhost
127.0.0.1		Alice.zomgnet		Alice

and just replace the names in the second line with what host/domain you want


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#5 2011-09-02 13:33:58

k6b
Member
From: Austin, TX
Registered: 2011-03-05
Posts: 7

Re: /etc/hosts

Excellent! Thanks for the great responses, I'll dig into the man file and do some fiddling when I get a chance today.

Guess this means that the 4 part hosts file that the wiki shows is incorrect too? I can imagine thousands with improperly configured hosts files.

Offline

Board footer

Powered by FluxBB