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@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@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

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):

[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@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
Documentation: http://www.balabit.com/support/documentation/?product=syslog-ng
FAQ: http://www.balabit.com/wiki/syslog-ng-faq

______________________________________________________________________________
Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng
Documentation: http://www.balabit.com/support/documentation/?product=syslog-ng
FAQ: http://www.balabit.com/wiki/syslog-ng-faq

______________________________________________________________________________
Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng
Documentation: http://www.balabit.com/support/documentation/?product=syslog-ng
FAQ: http://www.balabit.com/wiki/syslog-ng-faq



--
Bazsi