Comment 15 for bug 1909816

Revision history for this message
timecop (timecop-s) wrote : Re: [Bug 1909816] Re: asterisk spams console output to syslog due to systemd misconfiguration

On Wed, Oct 6, 2021 at 10:40 PM Athos Ribeiro
<email address hidden> wrote:
>
> Note that https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=971090 may
> be somewhat related to this one.
it probably is, because even asterisk doesn't log ansi to its own
logs, but does print it to console.

> It would be nice to hear from the Debian maintainer on this one before
> we move forward with applying the tty patch. Moreover, is there any
> change we could break users workflow by no longer logging that data from
> the `Standard{Error,Output}=null` patch?
Asterisk has always had its own logging, and the asterisk server
(headless) is *designed* to work without stdin/stdout connected and
logs using asterisk own methods. Because systemd redirects the console
output, we end up with double logs.

It can't possibly break anything because there's nothing to break
(nobody uses console output from the asterisk server, one could always
'asterisk -vvvvr' to connect to it remotely). All messages are already
logged to asterisk's own log locations.

>
> ** Bug watch added: Debian Bug tracker #971090
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=971090
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1909816
>
> Title:
> asterisk spams console output to syslog due to systemd
> misconfiguration
>
> Status in asterisk package in Ubuntu:
> Triaged
> Status in asterisk package in Debian:
> New
>
> Bug description:
> problem:
>
> Jan 2 00:23:40 fitpc systemd[1]: Starting Asterisk PBX...
> Jan 2 00:23:40 fitpc asterisk[2328]: #033[0mPBX UUID: xxxxxxxxxxxxxxxxxxxxxx
> Jan 2 00:23:40 fitpc asterisk[2328]: [Jan 2 00:23:40] #033[1;33mNOTICE#033[0m[2328]: #033[1;37mloader.c#033[0m:#033[1;37m2230#033[0m #033[1;37mload_modules#033[0m: 325 m
> odules will be loaded.
> Jan 2 00:23:40 fitpc asterisk[2328]: [Jan 2 00:23:40] #033[1;33mNOTICE#033[0m[2328]: #033[1;37mres_config_ldap.c#033[0m:#033[1;37m1830#033[0m #033[1;37mparse_config#033[
> 0m: No directory user found, anonymous binding as default.
>
> and so on, including all console messages from asterisk.
>
> The problem isn't the message, the problem is that stdout of asterisk
> service is continuously logged to syslog, despite asterisk already
> having a perfectly usable logging system which can be configured to
> log to file, or to syslog itself.
>
> Moreover, the ANSI codes aren't stripped, which makes the log look
> awful.
>
> after chatting in #ubuntu, i've been told I can fix this problem by
> the following:
>
> systemctl edit asterisk
>
> and adding the following to the override file:
>
> [Service]
> StandardOutput=null
> StandardError=null
>
> This indeed fixes the output spam and I can further edit
> /etc/asterisk/logger.conf to log stuff to syslog if I so wish, using
> the correct methods.
>
> So, I think the bug is that asterisk service definition file should
> include these stdout/stderr definitions by default.
>
> Thanks for looking into this.
>
> ProblemType: Bug
> DistroRelease: Ubuntu 20.04
> Package: asterisk 1:16.2.1~dfsg-2ubuntu1
> ProcVersionSignature: Ubuntu 5.4.0-58.64-generic 5.4.73
> Uname: Linux 5.4.0-58-generic x86_64
> ApportVersion: 2.20.11-0ubuntu27.14
> Architecture: amd64
> CasperMD5CheckResult: pass
> Date: Sat Jan 2 00:45:12 2021
> InstallationDate: Installed on 2020-12-28 (4 days ago)
> InstallationMedia: Ubuntu-Server 20.04.1 LTS "Focal Fossa" - Release amd64 (20200731)
> ProcEnviron:
> TERM=screen
> PATH=(custom, no user)
> XDG_RUNTIME_DIR=<set>
> LANG=C.UTF-8
> SHELL=/bin/bash
> SourcePackage: asterisk
> UpgradeStatus: No upgrade log present (probably fresh install)
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/ubuntu/+source/asterisk/+bug/1909816/+subscriptions
>