fix(lab): make Asterisk logs usable — drop ANSI codes and healthcheck noise
Logging was configured correctly and shipping to Loki, but the stream was useless: measured at 100% healthcheck chatter, with every line wrapped in ANSI escape codes. The real SIP events were there and completely buried. Three causes, each masking the next: - asterisk.conf was written in the first lab commit with `nocolor = yes` and never mounted, so the setting had no effect. Now mounted. It was also overriding [directories] and runuser/rungroup, which the image sets up correctly itself — removed, since overriding them risks breaking the container for no gain. - The image's command is `-vvvdddf`: verbosity 3 and debug 3 forced on the command line, which overrides both asterisk.conf and logger.conf. Overridden in compose to drop -v and -d; warnings and errors still log, and verbosity is raisable at runtime when tracing a call. - The actual source: the image's healthcheck makes ~7 separate `asterisk -rx` connections every 30s, and Asterisk logs a connect/disconnect pair for each. Replaced with a single check on a 60s interval, and the check now runs `pjsip show transports` rather than `core show version` — that fails when Asterisk is up but unconfigured, which is exactly the state that produced a "healthy" container with no SIP stack on first deploy. logger.conf drops both `notice` and `verbose`, which is where those pairs arrive. Verified on galatea: noise down from ~48 to 8 lines per two minutes (-83%), zero ANSI codes in Loki, 90% of the stream now signal, container still healthy, transport and dialplan intact. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,24 +1,17 @@
|
||||
; Minimal Asterisk core config for the lab.
|
||||
[directories](!)
|
||||
astetcdir => /etc/asterisk
|
||||
astmoddir => /usr/lib/asterisk/modules
|
||||
astvarlibdir => /var/lib/asterisk
|
||||
astdbdir => /var/lib/asterisk
|
||||
astkeydir => /var/lib/asterisk
|
||||
astdatadir => /var/lib/asterisk
|
||||
astagidir => /var/lib/asterisk/agi-bin
|
||||
astspooldir => /var/spool/asterisk
|
||||
astrundir => /var/run/asterisk
|
||||
astlogdir => /var/log/asterisk
|
||||
astsbindir => /usr/sbin
|
||||
|
||||
;
|
||||
; Deliberately does NOT set [directories] or runuser/rungroup: the image's
|
||||
; compiled-in defaults are correct, and it runs as the `asterisk` user via a
|
||||
; USER directive. Overriding either risks breaking the container for no gain
|
||||
; (an earlier version of this file did both).
|
||||
[options]
|
||||
; Log to stdout so Docker's json-file driver captures it and Alloy ships it.
|
||||
; A file-based log inside the container would be invisible to Loki.
|
||||
; Log to stdout so Docker's json-file driver captures it and Alloy ships it
|
||||
; to Loki. A file-based log inside the container would be invisible.
|
||||
verbose = 3
|
||||
debug = 0
|
||||
; No ANSI colour. Asterisk colourises the console by default and the escape
|
||||
; codes travel through Docker into Loki, where every line arrives wrapped in
|
||||
; \x1b[0;30m — unreadable in Grafana and awkward to filter on. This setting
|
||||
; lives here, not in logger.conf, and only takes effect if this file is
|
||||
; actually mounted into the container.
|
||||
nocolor = yes
|
||||
dumpcore = no
|
||||
; Never run as root inside the container.
|
||||
runuser = asterisk
|
||||
rungroup = asterisk
|
||||
|
||||
Reference in New Issue
Block a user