Bug 7999 - Vsmagent does not start if you configure syslog server
Summary: Vsmagent does not start if you configure syslog server
Status: NEW
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: Other (show other bugs)
Version: 4.14.0
Hardware: PC Linux Red Hat
: P2 Normal
Target Milestone: LowPrio
Assignee: Bugzilla mail exporter
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-10-05 18:12 CEST by Peter Wirdemo
Modified: 2022-10-25 12:36 CEST (History)
1 user (show)

See Also:
Acceptance Criteria:


Attachments

Description Peter Wirdemo 2022-10-05 18:12:09 CEST
When you enable syslog in /opt/thinlinc/etc/conf.d/vsmagent.hconf and sets syslog_host=syslog.
If "syslog" is not resolvable, the server crashes on startup.

# systemctl status vsmagent 
● vsmagent.service - ThinLinc VSM agent
   Loaded: loaded (/usr/lib/systemd/system/vsmagent.service; enabled; vendor preset: disabled)
   Active: failed (Result: timeout) since Mon 2022-09-26 19:51:45 CEST; 5min ago
  Process: 3402 ExecStart=/bin/bash --login -c /opt/thinlinc/sbin/vsmagent (code=exited, status=0/SUCCESS)

Sep 26 19:50:15 thinlinc systemd[1]: Starting ThinLinc VSM agent...
Sep 26 19:50:15 thinlinc systemd[1]: vsmagent.service: Can't open PID file /var/run/vsmagent.pid (yet?) after start: No such file or directory
Sep 26 19:51:45 thinlinc systemd[1]: vsmagent.service: start operation timed out. Terminating.
Sep 26 19:51:45 thinlinc systemd[1]: vsmagent.service: Failed with result 'timeout'.
Sep 26 19:51:45 thinlinc systemd[1]: Failed to start ThinLinc VSM agent.


The /var/log/vsmagent.log is a bit clearer ...



  File "/opt/thinlinc/sbin/vsmagent", line 18, in <module>
    OOoOoo000O00 ( )
  File "/opt/thinlinc/sbin/vsmagent", line 15, in OOoOoo000O00
    VSMAgent ( sys . argv )
  File "/opt/thinlinc/modules/thinlinc/vsm/vsmagent.py", line 116, in __init__
    self . setup_logging ( )
  File "/opt/thinlinc/modules/thinlinc/vsm/vsmagent.py", line 174, in setup_logging
    fd = sys . stdout )
  File "/opt/thinlinc/modules/thinlinc/tllogger.py", line 92, in __init__
    i1Ii1iiIiI111 = logging . handlers . SysLogHandler ( Oo0 , Ooo00ooO )
  File "/usr/lib64/python3.6/logging/handlers.py", line 837, in __init__
    ress = socket.getaddrinfo(host, port, 0, socktype)
  File "/usr/lib64/python3.6/socket.py", line 745, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/lib64/python3.6/logging/__init__.py", line 1946, in shutdown
    h.close()
  File "/usr/lib64/python3.6/logging/handlers.py", line 900, in close
    self.socket.close()
AttributeError: 'SysLogHandler' object has no attribute 'socket'

How about a nice message like "vsmagent can't resolv syslog, exiting..." :-)

A nice bonus would be adding a "vsmconftest" for basic and/or extended testing of configuration files ( like sshd -t ). Would fit nice in ansible validate environments.
Comment 1 Peter Wirdemo 2022-10-07 10:48:51 CEST
Hello again!

I have done some more research about this issue.

It does not matter if the syslog host is resolvable or not. The vsmagent does not start anyway if syslog is enabled. I think the problem behind this is the startup configuration in systemd.

If I enable syslog with a resolvable hostname, the vsmagent does not start
If I enable syslog with a unresolvable hostname, the vsmagent does not start.
If I enable syslog with a IP address, the vsmagent starts normally.

If I change the startup script.
# cd /etc/systemd/system
# cp /usr/lib/systemd/system/vsm* .

change the "After" tag from: After=network.target
to After=network-online.target.

If I enable syslog with a resolvable hostname, the vsmagent starts normally.
If I enable syslog with a unresolvable hostname, the vsmagent does not start.
If I enable syslog with a IP address, the vsmagent starts normally.

This is better than nothing...
Comment 2 Martin Östlund cendio 2022-10-20 09:33:45 CEST
Hi Peter,

Thank you for the report. 

ThinLinc does support logging directly to a remote syslog server. 
Wouldn't a more common scenario be to configure the logging for the vsm services to a local syslog first (by setting log_to_syslog=1 and leave out syslog_host), and then configure syslog to send logs to a remote system?

The advantage would be that the configuration is done in one place, instead of per application.

Could you share a bit more about the use case with us, is this something vital for your set-up?
Comment 3 Peter Wirdemo 2022-10-20 10:30:31 CEST
I agree!

Configure log_to_syslog=1 for using to local syslog service is enough for me.
Maybe an options for facility/level
Comment 4 Peter Wirdemo 2022-10-24 00:23:22 CEST
(In reply to Peter Wirdemo from comment #3)

> Maybe an options for facility/level

Found the syslog_facility config parameter.
Comment 5 Pierre Ossman cendio 2022-10-25 12:36:22 CEST
This should affect all services since they all use the same logging system, so changing component.

Note You need to log in before you can comment on or make changes to this bug.