[syslog-ng] startup and network sources

Evan Rempel erempel at uvic.ca
Thu Apr 18 16:56:54 UTC 2019


Looks like this has already been filed on github

https://github.com/balabit/syslog-ng/issues/2667

On 4/18/19 9:13 AM, Evan Rempel wrote:
> This name is already in the /etc/hosts file. I am attempting to listen on localhost.
>
> source local {
>         network(localip(localhost) transport("tcp") port(1514) max_connections(100) log_fetch_limit(500) log_iw_size(10000) flags(no-multi-line,syslog-protocol) tags(uvic.local) keep-timestamp(no) );
> };
>
> and the /etc/hosts file has
>
> 127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
>
> and on reboot ...
>
> 05:13:28.891 host daemon.notice systemd[1]: syslog-ng.service: main process exited, code=exited, status=2/INVALIDARGUMENT
> 05:13:28.891 host daemon.err systemd[1]: Failed to start System Logger Daemon.
> 05:13:28.891 host daemon.notice systemd[1]: Unit syslog-ng.service entered failed state.
> 05:13:28.891 host daemon.warning systemd[1]: syslog-ng.service failed.
> 05:13:29.007 host daemon.info systemd[1]: syslog-ng.service holdoff time over, scheduling restart.
> 05:13:29.009 host daemon.info systemd[1]: Stopped System Logger Daemon.
>
> 05:13:29.009 host daemon.info systemd[1]: Starting System Logger Daemon...
> 05:13:29.190 host daemon.info syslog-ng[6366]: [05:13:29.189991] Error resolving hostname; host='localhost'
> 05:13:29.197 host daemon.notice systemd[1]: syslog-ng.service: main process exited, code=exited, status=2/INVALIDARGUMENT
> 05:13:29.197 host daemon.err systemd[1]: Failed to start System Logger Daemon.
> 05:13:29.197 host daemon.notice systemd[1]: Unit syslog-ng.service entered failed state.
> 05:13:29.198 host daemon.warning systemd[1]: syslog-ng.service failed.
> 05:13:29.345 host daemon.info systemd[1]: syslog-ng.service holdoff time over, scheduling restart.
> 05:13:29.346 host daemon.info systemd[1]: Stopped System Logger Daemon.
>
> 05:13:29.346 host daemon.info systemd[1]: Starting System Logger Daemon...
> 05:13:29.412 host daemon.info syslog-ng[6457]: [05:13:29.412745] Error resolving hostname; host='localhost'
> 05:13:29.415 host daemon.notice systemd[1]: syslog-ng.service: main process exited, code=exited, status=2/INVALIDARGUMENT
> 05:13:29.415 host daemon.err systemd[1]: Failed to start System Logger Daemon.
> 05:13:29.415 host daemon.notice systemd[1]: Unit syslog-ng.service entered failed state.
> 05:13:29.415 host daemon.warning systemd[1]: syslog-ng.service failed.
> 05:13:29.556 host daemon.info systemd[1]: syslog-ng.service holdoff time over, scheduling restart.
> 05:13:29.556 host daemon.info systemd[1]: Stopped System Logger Daemon.
>
> 05:13:29.557 host daemon.info systemd[1]: Starting System Logger Daemon...
> 05:13:29.623 host daemon.info syslog-ng[6487]: [05:13:29.623206] Error resolving hostname; host='localhost'
> 05:13:29.626 host daemon.notice systemd[1]: syslog-ng.service: main process exited, code=exited, status=2/INVALIDARGUMENT
> 05:13:29.626 host daemon.err systemd[1]: Failed to start System Logger Daemon.
> 05:13:29.626 host daemon.notice systemd[1]: Unit syslog-ng.service entered failed state.
> 05:13:29.626 host daemon.warning systemd[1]: syslog-ng.service failed.
> 05:13:29.806 host daemon.info systemd[1]: syslog-ng.service holdoff time over, scheduling restart.
> 05:13:29.807 host daemon.info systemd[1]: Stopped System Logger Daemon.
>
> 05:13:29.807 host daemon.info systemd[1]: Starting System Logger Daemon...
> 05:13:29.867 host daemon.info syslog-ng[6537]: [05:13:29.867292] Error resolving hostname; host='localhost'
> 05:13:29.870 host daemon.notice systemd[1]: syslog-ng.service: main process exited, code=exited, status=2/INVALIDARGUMENT
> 05:13:29.870 host daemon.err systemd[1]: Failed to start System Logger Daemon.
> 05:13:29.870 host daemon.notice systemd[1]: Unit syslog-ng.service entered failed state.
> 05:13:29.870 host daemon.warning systemd[1]: syslog-ng.service failed.
>
> 05:13:29.893 host daemon.info network[6435]: Bringing up loopback interface:  [  OK  ]
>
> 05:13:30.009 host daemon.info systemd[1]: syslog-ng.service holdoff time over, scheduling restart.
> 05:13:30.009 host daemon.info systemd[1]: Stopped System Logger Daemon.
> 05:13:30.009 host daemon.warning systemd[1]: start request repeated too quickly for syslog-ng.service
> 05:13:30.010 host daemon.err systemd[1]: Failed to start System Logger Daemon.
> 05:13:30.010 host daemon.notice systemd[1]: Unit syslog-ng.service entered failed state.
> 05:13:30.010 host daemon.warning systemd[1]: syslog-ng.service failed.
>
> 05:13:34.214 host daemon.info network[6435]: Bringing up interface eth0:  [  OK  ]
>
> 05:13:34.242 host daemon.info systemd[1]: Reached target Network.
>
> 05:13:37.651 host lpr.info cupsd[6665]: Listening to 127.0.0.1:631 on fd 10...
>
>
> After this (when I can log in) a simple "service syslog-ng start" will correctly start the syslog-ng service.
>
> the rsyslog package does have systemd unit file definitions of
>
> [Unit]
> Wants=network.target network-online.target
> After=network.target network-online.target
>
> but that might be Redhat's way of saying that systemd-journal is good enough when you don't have networking since
>
> [Install]
> WantedBy=multi-user.target
>
> is also present meaning that rsyslog is only started when a multi-user boot is done.
>
> Since the syslog-ng.service file also includes
>
> [Install]
> WantedBy=multi-user.target
>
> I think that it is reasonable to add the unit definitions of
>
> [Unit]
> Wants=network.target network-online.target
> After=network.target network-online.target
>
> and the problem just goes away for normal boot up environments.
>
> I think I'll post this as a packaging systemd unit file definition bug.
>
>
> On 4/17/19 11:29 PM, Scheidler, Balázs wrote:
>> You mean bind address is specified by dns? You could add that to the hosts file.
>>
>> Bazsi
>>
>> On Wed, Apr 17, 2019, 23:48 Evan Rempel <erempel at uvic.ca <mailto:erempel at uvic.ca> wrote:
>>
>>     I've been looking at an interesting scenario on Redhat 7 (systemd) where syslog-ng fails to start because it can not resolve a network source name. This happens because the network has not started. Systemd attempts to restart syslog-ng a few times and then decides that  it is restarting syslog-ng too quickly and gives up on it.
>>
>>
>>     2019-04-17T05:13:30.009 daemon.warning systemd[1]: start request repeated too quickly for syslog-ng.service
>>     2019-04-17T05:13:30.010 daemon.err systemd[1]: Failed to start System Logger Daemon.
>>     2019-04-17T05:13:30.010 daemon.notice systemd[1]: Unit syslog-ng.service entered failed state.
>>     2019-04-17T05:13:30.010 daemon.warning systemd[1]: syslog-ng.service failed.
>>
>>
>>     My first reaction was to add the "Wants=network-online.target" to the service definition to make syslog-ng start after the network has started, but that would mean that if I boot up without a network that syslog-ng would never start, and that seems incorrect to me.
>>
>>     Is there a way to to configure a network source to be optional and continue to retry binding to it after startup?
>>
>>     How do others handle this issue?
>>
>>     -- 
>>     Evan
>>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.balabit.hu/pipermail/syslog-ng/attachments/20190418/1ce72637/attachment-0001.html>


More information about the syslog-ng mailing list