Skip to main content
Topic: syslog-ng fails to start (Read 1244 times) previous topic - next topic
0 Members and 3 Guests are viewing this topic.

syslog-ng fails to start

Hi devs,

after the latest update I did yesterday, syslog-ng would not start anymore.

The error message was:
Code: [Select]
# /etc/init.d/syslog-ng start
 * Caching service dependencies ...                                                           [ ok ]
 * Checking your configfile (/etc/syslog-ng/syslog-ng.conf) ...
[2023-07-28T14:11:45.221140] python: private virtualenv is not initialized, use the `syslog-ng-update-virtualenv' script to initialize it or make sure all required Python dependencies are available in the system Python installation; path='/var/lib/syslog-ng/python-venv'
[2023-07-28T14:11:45.248027] Error evaluating global Python block; exception='ModuleNotFoundError: No module named \'requests\''
Traceback (most recent call last):
  File "/etc/syslog-ng/syslog-ng.conf{python-global-code:25}", line 3, in <module>
    import syslogng.modules.hypr
  File "/usr/lib/syslog-ng/python/syslogng/modules/hypr/__init__.py", line 48, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'
Error parsing python, Error processing global python block in /usr/lib/syslog-ng/python/syslogng/modules/hypr/scl/hypr.conf:25:1-25:7:
20      # OpenSSL libraries as published by the OpenSSL project. See the file
21      # COPYING for details.
22      #
23      #############################################################################
24     
25----> python {
25----> ^^^^^^
26     
27      import syslogng.modules.hypr
28     
29      syslogng.modules.hypr.register_hypr_config_generator()
30     

Included from /usr/share/syslog-ng/include/scl/python/python-modules.conf:25:1-25:1:

Included from /etc/syslog-ng/scl.conf:31:1-31:1:
26      #
27     
28      @module appmodel
29     
30      @include 'scl/*/*.conf'
31---->
31----> ^
32      @define java-module-dir "`module-install-dir`/java-modules"

Included from /etc/syslog-ng/syslog-ng.conf:3:1-3:1:
1       @version: 4.2
2       @include "scl.conf"
3-----> #
3-----> ^
4       # /etc/syslog-ng/syslog-ng.conf
5       #
6      
7       options {
8         stats_freq (0);

 * Configuration error. Please fix your configfile (/etc/syslog-ng/syslog-ng.conf)            [ !! ]
 * ERROR: syslog-ng failed to start
After manually installing the python-requests package, syslog-ng did start, but still complained:
Code: [Select]
 * Checking your configfile (/etc/syslog-ng/syslog-ng.conf) ...
[2023-07-28T14:12:22.070697] python: private virtualenv is not initialized, use the `syslog-ng-update-virtualenv' script to initialize it or make sure all required Python dependencies are available in the system Python installation; path='/var/lib/syslog-ng/python-venv'
[2023-07-28T14:12:24.517426] WARNING: Your configuration file uses an obsoleted keyword, please update your configuration; keyword='stats_freq', change='Use the stats() block. E.g. stats(freq(1));', location='/etc/syslog-ng/syslog-ng.conf:8:3'                                                   [ ok ]
 * Starting syslog-ng ...                                                                     [ ok ]
And after having run syslog-ng-update-virtualenv (which installed pip and all kinds of python modules), it still complained ;-)

Here's what the script did:
Code: [Select]
# syslog-ng-update-virtualenv
This script will download 3rd party packages from the Python Package Index
(PyPI) using the pip tool.  The installation of these packages will cause
build/postinst scripts to be executed as the root user on this system.

Press [ENTER] to confirm or Ctrl-C to terminate this script.

Creating or updating syslog-ng Python virtualenv in /var/lib/syslog-ng/python-venv
Running python -m venv...
Running python -m pip install...
Requirement already satisfied: pip in /var/lib/syslog-ng/python-venv/lib/python3.11/site-packages (22.3.1)
Collecting pip
  Downloading pip-23.2.1-py3-none-any.whl (2.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 4.3 MB/s eta 0:00:00
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 22.3.1
    Uninstalling pip-22.3.1:
      Successfully uninstalled pip-22.3.1
Successfully installed pip-23.2.1
Requirement already satisfied: pip in /var/lib/syslog-ng/python-venv/lib/python3.11/site-packages (23.2.1)
Requirement already satisfied: setuptools in /var/lib/syslog-ng/python-venv/lib/python3.11/site-packages (65.5.0)
Collecting setuptools
  Obtaining dependency information for setuptools from https://files.pythonhosted.org/packages/c7/42/be1c7bbdd83e1bfb160c94b9cafd8e25efc7400346cf7ccdbdb452c467fa/setuptools-68.0.0-py3-none-any.whl.metadata
  Downloading setuptools-68.0.0-py3-none-any.whl.metadata (6.4 kB)
Downloading setuptools-68.0.0-py3-none-any.whl (804 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 804.0/804.0 kB 4.1 MB/s eta 0:00:00
Installing collected packages: setuptools
  Attempting uninstall: setuptools
    Found existing installation: setuptools 65.5.0
    Uninstalling setuptools-65.5.0:
      Successfully uninstalled setuptools-65.5.0
Successfully installed setuptools-68.0.0
Collecting cachetools==4.2.4 (from -r /usr/lib/syslog-ng/python/requirements.txt (line 1))
  Downloading cachetools-4.2.4-py3-none-any.whl (10 kB)
Collecting certifi==2022.12.7 (from -r /usr/lib/syslog-ng/python/requirements.txt (line 2))
  Downloading certifi-2022.12.7-py3-none-any.whl (155 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 155.3/155.3 kB 1.5 MB/s eta 0:00:00
Collecting charset-normalizer==2.0.12 (from -r /usr/lib/syslog-ng/python/requirements.txt (line 3))
  Downloading charset_normalizer-2.0.12-py3-none-any.whl (39 kB)
Collecting google-auth==2.13.0 (from -r /usr/lib/syslog-ng/python/requirements.txt (line 4))
  Downloading google_auth-2.13.0-py2.py3-none-any.whl (174 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 174.5/174.5 kB 2.5 MB/s eta 0:00:00
Collecting idna==3.4 (from -r /usr/lib/syslog-ng/python/requirements.txt (line 5))
  Downloading idna-3.4-py3-none-any.whl (61 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.5/61.5 kB 1.1 MB/s eta 0:00:00
Collecting kubernetes==25.3.0 (from -r /usr/lib/syslog-ng/python/requirements.txt (line 6))
  Downloading kubernetes-25.3.0-py2.py3-none-any.whl (1.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 5.0 MB/s eta 0:00:00
Collecting oauthlib==3.2.2 (from -r /usr/lib/syslog-ng/python/requirements.txt (line 7))
  Downloading oauthlib-3.2.2-py3-none-any.whl (151 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 151.7/151.7 kB 2.3 MB/s eta 0:00:00
Collecting pyasn1==0.4.8 (from -r /usr/lib/syslog-ng/python/requirements.txt (line 8))
  Downloading pyasn1-0.4.8-py2.py3-none-any.whl (77 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 77.1/77.1 kB 1.2 MB/s eta 0:00:00
Collecting pyasn1-modules==0.2.8 (from -r /usr/lib/syslog-ng/python/requirements.txt (line 9))
  Downloading pyasn1_modules-0.2.8-py2.py3-none-any.whl (155 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 155.3/155.3 kB 2.4 MB/s eta 0:00:00
Collecting python-dateutil==2.8.2 (from -r /usr/lib/syslog-ng/python/requirements.txt (line 10))
  Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 247.7/247.7 kB 3.7 MB/s eta 0:00:00
Collecting PyYAML==6.0 (from -r /usr/lib/syslog-ng/python/requirements.txt (line 11))
  Downloading PyYAML-6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (757 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 757.9/757.9 kB 4.2 MB/s eta 0:00:00
Collecting requests==2.27.1 (from -r /usr/lib/syslog-ng/python/requirements.txt (line 12))
  Downloading requests-2.27.1-py2.py3-none-any.whl (63 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 63.1/63.1 kB 881.6 kB/s eta 0:00:00
Collecting requests-oauthlib==1.3.1 (from -r /usr/lib/syslog-ng/python/requirements.txt (line 13))
  Downloading requests_oauthlib-1.3.1-py2.py3-none-any.whl (23 kB)
Collecting rsa==4.9 (from -r /usr/lib/syslog-ng/python/requirements.txt (line 14))
  Downloading rsa-4.9-py3-none-any.whl (34 kB)
Collecting six==1.16.0 (from -r /usr/lib/syslog-ng/python/requirements.txt (line 15))
  Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting urllib3==1.26.12 (from -r /usr/lib/syslog-ng/python/requirements.txt (line 16))
  Downloading urllib3-1.26.12-py2.py3-none-any.whl (140 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 140.4/140.4 kB 2.2 MB/s eta 0:00:00
Collecting websocket-client==1.3.1 (from -r /usr/lib/syslog-ng/python/requirements.txt (line 17))
  Downloading websocket_client-1.3.1-py3-none-any.whl (54 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 54.2/54.2 kB 1.4 MB/s eta 0:00:00
Collecting ply==3.11 (from -r /usr/lib/syslog-ng/python/requirements.txt (line 18))
  Downloading ply-3.11-py2.py3-none-any.whl (49 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 49.6/49.6 kB 751.7 kB/s eta 0:00:00
Requirement already satisfied: setuptools>=21.0.0 in /var/lib/syslog-ng/python-venv/lib/python3.11/site-packages (from kubernetes==25.3.0->-r /usr/lib/syslog-ng/python/requirements.txt (line 6)) (68.0.0)
Installing collected packages: pyasn1, ply, websocket-client, urllib3, six, rsa, PyYAML, pyasn1-modules, oauthlib, idna, charset-normalizer, certifi, cachetools, requests, python-dateutil, google-auth, requests-oauthlib, kubernetes
Successfully installed PyYAML-6.0 cachetools-4.2.4 certifi-2022.12.7 charset-normalizer-2.0.12 google-auth-2.13.0 idna-3.4 kubernetes-25.3.0 oauthlib-3.2.2 ply-3.11 pyasn1-0.4.8 pyasn1-modules-0.2.8 python-dateutil-2.8.2 requests-2.27.1 requests-oauthlib-1.3.1 rsa-4.9 six-1.16.0 urllib3-1.26.12 websocket-client-1.3.1
Finished.

And here's syslog-ng still bitching:
Code: [Select]
* Stopping syslog-ng ...                                                                     [ ok ]
 * Checking your configfile (/etc/syslog-ng/syslog-ng.conf) ...
[2023-07-28T14:13:49.466006] WARNING: Your configuration file uses an obsoleted keyword, please update your configuration; keyword='stats_freq', change='Use the stats() block. E.g. stats(freq(1));', location='/etc/syslog-ng/syslog-ng.conf:8:3'                                                   [ ok ]
 * Starting syslog-ng ...                                                                     [ ok ]
I could finally fix it via editing the syslog-ng config file:

Instead of
Code: [Select]
stats_freq (0);
I wrote
Code: [Select]
stats(freq(0));
… and syslog-ng was finally happy ;-)

Maybe, you want to fix this?

Cheers, Tobias

Re: syslog-ng fails to start

Reply #1
Hi Tobias and Devs.

Yesterday: fresh install form latest stable  LXDE ISO, followed immediately by pacman -Syu
Today: Installing the packages needed on the new machine, ntp-client start fails, as syslog-ng fails:

Code: [Select]
broesel:[root]:~# grep -i syslog /var/log/pacman.log 
[2023-08-05T18:35:04+0200] [ALPM] warning: directory permissions differ on /var/lib/syslog-ng/
[2023-08-05T18:35:04+0200] [ALPM] upgraded syslog-ng (4.1.1-1.5 -> 4.2.0-1)
broesel:[root]:~#

After this update I have the same error on startup of syslog-ng. I suspect Tobias' problem has been resolved: My Problem was resolved by installing python, python-setuptools, python-pip and running syslog-ng-update-virtualenv.

Is there  still a problem somewhere in the dependencies though? If syslog-ng now needs python etc   as  hard dependencies then the packages should get installed....

CU

Andrew

Re: syslog-ng fails to start

Reply #2
just installing and running apache, i came across this error.

ajsmiller/Andrew's solution made things work, but it still complained about stats_freq. so i changed to stats(freq()), as l3u/Tobias said. it seems fine now, no complaints.

but yeah, it seems broken out of the box. looks like it needs a real upstream solution.

Re: syslog-ng fails to start

Reply #3
Hi all

It looks like syslog-ng includes hypr python module configuration by default

If you do not use hypr and do not want to use this python module just remove (or rename to e.g. hypr.conf.bak) file
/usr/lib/syslog-ng/python/syslogng/modules/hypr/scl/hypr.conf

here is a thoughts of the (I believe) author of syslog-ng:
https://www.syslog-ng.com/community/b/blog/posts/syslog-ng-python-packaging


 

Re: syslog-ng fails to start

Reply #5
I can confirm the obsoleted keyword was there since at least 2023.07.28 - I see it in my logs too.

Re: syslog-ng fails to start

Reply #6
This has already been solved by this commit

this thread is solved.

I can confirm the obsoleted keyword was there since at least 2023.07.28 - I see it in my logs too.
you may need to to update your config manually, if you have done any change. the new config will be saved as a ".pacnew" file to prevent user custom setting, if you never changed the file, the config probably has been updated by itself. 

Re: syslog-ng fails to start

Reply #7
Thanks Suren.

I3U could you please mark this as solved then?