Bug 5452 - overly complex custom log system (use syslog instead?)
Summary: overly complex custom log system (use syslog instead?)
Status: NEW
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: Other (show other bugs)
Version: pre-1.0
Hardware: PC Unknown
: P2 Normal
Target Milestone: MediumPrio
Assignee: Henrik Andersson
URL:
Keywords:
Depends on:
Blocks: 5457
  Show dependency treegraph
 
Reported: 2015-02-26 13:10 CET by Pierre Ossman
Modified: 2023-11-29 15:49 CET (History)
1 user (show)

See Also:
Acceptance Criteria:


Attachments

Description Pierre Ossman cendio 2015-02-26 13:10:49 CET
Currently we have a lot of infrastructure to handle the fact that we have our own custom logging system. Perhaps we should consider dropping that in favour of plain old syslog? It is available as an option currently, but it is not the default and we could only simplify things if it was the only option.

Advantages of syslog is that it is how almost everything else on the system logs. It has network logging abilities and is a standardised system that allows compatibility with things like journald. syslog is also easier to use from any random part of thinlinc as it doesn't require write access to /var/log directly.

The downside is that you can't easily get a log file per service like we have today.
Comment 1 Pierre Ossman cendio 2015-03-03 11:46:28 CET
The first step will be to investigate more and get a better list of advantages and problems with going with just syslog. We should also check why we chose a file based logging in the first place.
Comment 2 Henrik Andersson cendio 2015-09-01 08:27:39 CEST
(In reply to comment #0)

> The downside is that you can't easily get a log file per service like we have
> today.

It is pretty easy to get a logfile per process using syslog.

rsyslog [2] "is" the de-facto [1] syslogd on linux and uses /etc/rsyslog.d for reading configuration rules. Consider the following example to get a specific logfile for vsmagent.

  /etc/rsyslog.d/vsmagent.conf 

  :programname, isequal, "vsmagent" /var/log/vsmagent.log


[1] See https://en.wikipedia.org/wiki/Rsyslog which lists dists and version from when they start using rsyslog, previous de-facto syslog server used was syslog-ng.

[2] http://blog.gerhards.net/2007/08/why-does-world-need-another-syslogd.html
Comment 3 Henrik Andersson cendio 2015-09-01 08:45:05 CEST
Summary of syslog logging:

 - A log message is prepended with (Processname or application defined ident)

 - A PID can also be logged with the message see. openlog() option LOG_PID.

 - Uses facilities and levels to categorize a log message, which gives the sysadmin great possibilities to control how things are logged, setup triggers for event generation such as SNMP traps etc.

 - Facilities: AUTH, AUTHPRIV, CRON, DAEMON, FTP, KERN,
               NEWS, SYSLOG, USER (default)

 - Levels: EMERG, ALERT, CRIT, ERR, WARNING, NOTICE,
           INFO, DEBUG

Typical use:

  openlog("vsmserver", LOG_PID)
  syslog(LOG_AUTH|LOG_WARNING, "User x failed to authenticate");

Using openlog is optional but if one want to use application defined ident and/or LOG_PID, one need to use it.
Comment 4 Henrik Andersson cendio 2015-09-01 09:27:22 CEST
(In reply to comment #1)

> We should also check why we chose a file based logging in the first place.

Bug 554 was about to improve the logging which was filebased from start. The solution using python logging module introduces the support for syslog. Didn't find any information / reasoning why filebased is default and used but probably a inheritance from start.
Comment 5 Henrik Andersson cendio 2015-09-01 12:30:15 CEST
Can we use syslog for all logging or do we have special logging that does not fit in syslog ? (Think http access logs for tlwebadm / tlwebacces) etc.

Identify our logfiles and summarize the content to get a feel of what we have and how we could handle them.
Comment 6 Henrik Andersson cendio 2015-09-02 09:20:57 CEST
(In reply to comment #5)
> Can we use syslog for all logging or do we have special logging that does not
> fit in syslog ? (Think http access logs for tlwebadm / tlwebacces) etc.
> 
> Identify our logfiles and summarize the content to get a feel of what we have
> and how we could handle them.


# /var/log/thinlinc-install.log

Logfile created by ThinLinc installer. This log does not fit for syslog, it is a user application started by user at specific times.


# /var/log/tlsetup.log

tlsetup.log is created by tl-setup, a tool which should be run at each install / upgrade. This log does not fit for syslog, it is a user application started by user at specific times.


# /var/log/thinlinc-user-licenses

Some kind of database for licenses, written to by sessionstore and parsed by parse_licenselog... Does not fit syslog.


# /var/log/tlwebaccess.log

This logfile contains both http access log like apache and service logging. The  access log part does not fit syslog and need to split out...


# /var/log/tlwebadm.log

This logfile suffers of same problems as tlwebaccess.log above.


# /var/log/vsmagent.log

This logfile is for the vsmagent service which would work perfect with syslog.


# /var/log/vsmserver.log

This logfile is for vsmserver service which would work perfect with syslog.
Comment 7 Henrik Andersson cendio 2015-09-02 09:44:39 CEST
(In reply to comment #5)
> Can we use syslog for all logging or do we have special logging that does not
> fit in syslog ? (Think http access logs for tlwebadm / tlwebacces) etc.
> 
> Identify our logfiles and summarize the content to get a feel of what we have
> and how we could handle them.

# /var/opt/thinlinc/sessions/<user>/last/xinit.log

This logfile catches stdout/stderr from anything running within the session (tl-xinit). tl-shadow-notify-helper also reads and parse this logfile to track connections.

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