[syslog-ng] syslog-ng restarts due to interface not ready

Laszlo Szemere (lszemere) Laszlo.Szemere at oneidentity.com
Tue Jul 21 11:27:37 UTC 2020


Hello Alex,

 an another solution would be to make systemd aware that your service takes longer time to start up. (Which can lead to other problems beside syslog-ng startup.)
 Please refer to systemd.service "Type" parameter: https://www.freedesktop.org/software/systemd/man/systemd.service.html#Type= , maybe your service supports it. This way systemd will automatically resolves the synchronization between your services.

Best regards,
Laci

________________________________
From: syslog-ng <syslog-ng-bounces at lists.balabit.hu> on behalf of Balazs Scheidler <bazsi77 at gmail.com>
Sent: Tuesday, July 21, 2020 13:22
To: Syslog-ng users' and developers' mailing list <syslog-ng at lists.balabit.hu>
Subject: Re: [syslog-ng] syslog-ng restarts due to interface not ready

CAUTION: This email originated from outside of the organization. Do not follow guidance, click links, or open attachments unless you recognize the sender and know the content is safe.

This sysctl may of help (in /proc/sys/net/ipv4)

       ip_nonlocal_bind (Boolean; default: disabled; since Linux 2.4)
              If set, allows processes to bind(2) to nonlocal IP addresses,  which  can  be
              quite useful, but may break some applications.

A syslog-ng specific option would be to allow setting IP_FREEBIND on listener sockets, which would be a handy feature.

       IP_FREEBIND (since Linux 2.4)
              If enabled, this boolean option allows binding to an IP address that is  non‐
              local  or  does not (yet) exist.  This permits listening on a socket, without
              requiring the underlying  network  interface  or  the  specified  dynamic  IP
              address  to  be  up at the time that the application is trying to bind to it.
              This option is the per-socket equivalent of the ip_nonlocal_bind /proc inter‐
              face described below.

On Tue, Jul 21, 2020 at 12:18 PM Alexandre Santos <alexandre.rosas.santos at gmail.com<mailto:alexandre.rosas.santos at gmail.com>> wrote:
Thank you for your answer,

Unfortunately, this did not solve the problem, because the interface is being created by an application on startup.

Do you know any way to check if the interface exists before trying to connect using syslog-ng configurations?

Thanks,
Alex

On Fri, Jun 26, 2020 at 10:52 AM Nagy Gábor <gabor.hl at gmail.com<mailto:gabor.hl at gmail.com>> wrote:
Hi,

I think the syslog-ng service file needs to be updated so it will start after the network.service.
We've had a bug report about this: https://github.com/syslog-ng/syslog-ng/issues/2667<https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fsyslog-ng%2Fsyslog-ng%2Fissues%2F2667&data=02%7C01%7CLaszlo.Szemere%40oneidentity.com%7Cd16d1a99376449e266b208d82d6854b8%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637309273415260094&sdata=zI36BB2QBdlDUp0%2Bpz6Mv%2Fs22bc0nmcqXUG%2Fz%2FJlCKM%3D&reserved=0>

We fixed this in syslog-ng 3.25
We added the "Wants" and "After" options (see https://github.com/syslog-ng/syslog-ng/pull/2994/files<https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fsyslog-ng%2Fsyslog-ng%2Fpull%2F2994%2Ffiles&data=02%7C01%7CLaszlo.Szemere%40oneidentity.com%7Cd16d1a99376449e266b208d82d6854b8%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637309273415260094&sdata=0yMaF5Yy%2BFxpsgg%2F3OZgz8YVFV%2FwCsQFxQ1WipMnyAI%3D&reserved=0>):

[Unit]
Description=System Logger Daemon
Documentation=man:syslog-ng(8)
Wants=network.target network-online.target
After=network.target network-online.target

Maybe I'm wrong, but at first glance I think this could fix your boot issue.

Regards,
Gabor

Alexandre Santos <alexandre.rosas.santos at gmail.com<mailto:alexandre.rosas.santos at gmail.com>> ezt írta (időpont: 2020. jún. 26., P, 11:33):

Hi,

I have a configuration where one of my sources is a syslog source:

syslog(ip(127.1.1.1) transport("udp") port(514) keep-alive(no));


But when the system starts up, the interface is not ready yet, and I get the following errors:


Jun 26 09:17:50 localhost systemd[1]: Starting System Logger Daemon...
Jun 26 09:17:52 localhost syslog-ng[2301]: [2020-06-26T09:17:52.485148] WARNING: With use-dns(no), dns-cache() will be forced to 'no' too!;
Jun 26 09:17:52 localhost syslog-ng[2301]: [2020-06-26T09:17:52.487159] Current position not matches to the saved cursor position, seek to head; cursor='s=f62c0e80f50948deb29cf2d28230a
Jun 26 09:17:52 localhost syslog-ng[2301]: [2020-06-26T09:17:52.487867] Error resolving hostname; host='127.1.1.1'
Jun 26 09:17:52 localhost syslog-ng[2301]: [2020-06-26T09:17:52.487878] Error initializing message pipeline; plugin_name='syslog', location='/etc/syslog-ng/syslog-ng.conf:43:5'
Jun 26 09:17:52 localhost systemd[1]: syslog-ng.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Jun 26 09:17:52 localhost systemd[1]: syslog-ng.service: Failed with result 'exit-code'.
Jun 26 09:17:52 localhost systemd[1]: Failed to start System Logger Daemon.
Jun 26 09:17:52 localhost systemd[1]: syslog-ng.service: Service RestartSec=100ms expired, scheduling restart.
Jun 26 09:17:52 localhost systemd[1]: syslog-ng.service: Scheduled restart job, restart counter is at 1.


When the systemd reaches the 5 attempts it disables the syslog-ng.service.


Do you know some way to fix this, by adding something, the syslog-ng configuration?


Thanks in Advance,

Alex

______________________________________________________________________________
Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng<https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.balabit.hu%2Fmailman%2Flistinfo%2Fsyslog-ng&data=02%7C01%7CLaszlo.Szemere%40oneidentity.com%7Cd16d1a99376449e266b208d82d6854b8%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637309273415270052&sdata=es%2BBqL0MAbI26UbFy1NbBxe5Ey7j%2BvMdJ9bjUj6U63Q%3D&reserved=0>
Documentation: http://www.balabit.com/support/documentation/?product=syslog-ng<https://nam05.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.balabit.com%2Fsupport%2Fdocumentation%2F%3Fproduct%3Dsyslog-ng&data=02%7C01%7CLaszlo.Szemere%40oneidentity.com%7Cd16d1a99376449e266b208d82d6854b8%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637309273415270052&sdata=6vKRjMNO%2FmrDtWmuLMGH%2FTm91jICMMRwHvL8%2FV76TGs%3D&reserved=0>
FAQ: http://www.balabit.com/wiki/syslog-ng-faq<https://nam05.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.balabit.com%2Fwiki%2Fsyslog-ng-faq&data=02%7C01%7CLaszlo.Szemere%40oneidentity.com%7Cd16d1a99376449e266b208d82d6854b8%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637309273415270052&sdata=dAnb1vkFH65snzchDoRcHvAcMBVGPCcc3UfiYWFx1qI%3D&reserved=0>

______________________________________________________________________________
Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng<https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.balabit.hu%2Fmailman%2Flistinfo%2Fsyslog-ng&data=02%7C01%7CLaszlo.Szemere%40oneidentity.com%7Cd16d1a99376449e266b208d82d6854b8%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637309273415280012&sdata=qYvFnQB%2FpAbSfzQwfPPDug0KijG%2BTBBCMlRLv5jrtNc%3D&reserved=0>
Documentation: http://www.balabit.com/support/documentation/?product=syslog-ng<https://nam05.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.balabit.com%2Fsupport%2Fdocumentation%2F%3Fproduct%3Dsyslog-ng&data=02%7C01%7CLaszlo.Szemere%40oneidentity.com%7Cd16d1a99376449e266b208d82d6854b8%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637309273415280012&sdata=oW9SKARshDLoDXB7ztrV3GPhwa347TwkYXmhzKZz1CE%3D&reserved=0>
FAQ: http://www.balabit.com/wiki/syslog-ng-faq<https://nam05.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.balabit.com%2Fwiki%2Fsyslog-ng-faq&data=02%7C01%7CLaszlo.Szemere%40oneidentity.com%7Cd16d1a99376449e266b208d82d6854b8%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637309273415289967&sdata=LJIsWFP1r%2BngtQ%2Fd81Gs4NstQQDjoXaCw02oYMoQ044%3D&reserved=0>

______________________________________________________________________________
Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng<https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.balabit.hu%2Fmailman%2Flistinfo%2Fsyslog-ng&data=02%7C01%7CLaszlo.Szemere%40oneidentity.com%7Cd16d1a99376449e266b208d82d6854b8%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637309273415289967&sdata=KMT4aME%2F0aLQuTGNnmqEAGJ2%2B8RH1piD%2FLB0Yj61KYw%3D&reserved=0>
Documentation: http://www.balabit.com/support/documentation/?product=syslog-ng<https://nam05.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.balabit.com%2Fsupport%2Fdocumentation%2F%3Fproduct%3Dsyslog-ng&data=02%7C01%7CLaszlo.Szemere%40oneidentity.com%7Cd16d1a99376449e266b208d82d6854b8%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637309273415289967&sdata=1YJILOOKkpKFvRJu4sk4eutj8EPP%2Bvnm4uD8JZtqaCE%3D&reserved=0>
FAQ: http://www.balabit.com/wiki/syslog-ng-faq<https://nam05.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.balabit.com%2Fwiki%2Fsyslog-ng-faq&data=02%7C01%7CLaszlo.Szemere%40oneidentity.com%7Cd16d1a99376449e266b208d82d6854b8%7C91c369b51c9e439c989c1867ec606603%7C0%7C0%7C637309273415299921&sdata=ycQ%2FyBTZqU3rLwg59vRonz2ZATUc6HRqLQatxH1huYc%3D&reserved=0>



--
Bazsi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.balabit.hu/pipermail/syslog-ng/attachments/20200721/043a2e72/attachment-0001.html>


More information about the syslog-ng mailing list