# syslog-ng shows no hostname if it is supplied by dhcp-server

## DawgG

i have some hosts that get their hostname with dhcp only (no /etc/hostname and /etc/conf.d/hostname ist empty; MACs registered on DHCP-server). their syslog-ng is configured to additionally log to a loghost over the network. some new installations show up as (none) on the loghost and the local /var/log/messages-file if the systems boot with the supplied initscripts.

the hostname is only shown if syslog-ng is restarted again after the "normal" system-start; eg:

```
Jul 16 11:59:19 (none) root[6793]: blabla

Jul 16 11:59:29 (none) syslog-ng[747]: syslog-ng shutting down; version='3.6.2'

Jul 16 11:59:29 zb-opac-606 syslog-ng[6838]: syslog-ng starting up; version='3.6.2'

Jul 16 11:59:34 zb-opac-606 root[6847]: blabla
```

what's the reason for this and how can it be fixed? is there a dep missing in some initscript? hostname (that syslog-ng depend on) ist started:

```

Jul 16 12:07:12 (none) ntpd[1179]: peer 10.10.1.238 now valid

Jul 16 12:07:16 (none) ntpd[1179]: peer 10.10.1.239 now valid

zb-opac-603 ~ # /etc/init.d/hostname status

 * status: started
```

when the hostname is set in a static file this does not happen; but even though those hosts are pretty static i want to keep configuring their hostnames with dhcp only.

is there a better way than restarting syslog-ng after system-boot?

----------

## Roman_Gruber

I am not a specialist

 *Quote:*   

> is there a better way than restarting syslog-ng after system-boot?

 

You mean restarting after dhcp figured out who is who.

There may be a way to make it depend on net or something or just generate a rule to restart it.

Yuo need to code it that way that the default settings cause a regular check until you get something else as the default. some sort of timeout to try again. 

i talk about hte 169.xx.xx.xx adress range which is asigned by dhcp when the network node is "dead"....

maybe doable with some sort of /etc/init.d/script ...

HAve you checked dhcpcd settins and syslog-ng settings for anything which can be used in this fashion?

----------

## DawgG

 *Quote:*   

> There may be a way to make it depend on net or something or just generate a rule to restart it.

 

that was my first thought but it is definitely for a reason that the logger starts way before the net.

i compared this to older installs i have and in those syslog-ng "knows" the hostname straight from the start - that's what bothers me a little bit. the older install is syslog-ng-3.4.8; the new is syslog-ng-3.6.2

i'll test around a little more but will probably go for the cheap way of restarting syslog-ng with /etc/local.d/XX-bla.start - in case logged info on a client  from before the network start is needed it will most likely not matter if the hostname in this case is (none).

THX for your input!

----------

