diff --git a/tests/lab/dialplan/asterisk.conf b/tests/lab/dialplan/asterisk.conf index 2e71279..c6a91fe 100644 --- a/tests/lab/dialplan/asterisk.conf +++ b/tests/lab/dialplan/asterisk.conf @@ -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 diff --git a/tests/lab/dialplan/logger.conf b/tests/lab/dialplan/logger.conf index 6c15a54..76f4306 100644 --- a/tests/lab/dialplan/logger.conf +++ b/tests/lab/dialplan/logger.conf @@ -3,6 +3,22 @@ ; the container would put the logs where nothing can see them. [general] dateformat = %F %T +; Colour is disabled in asterisk.conf (`nocolor = yes`), not here — Asterisk +; colourises the console by default and the escape codes travel through Docker +; into Loki, where every line arrives wrapped in \x1b[0;30m. That file must be +; mounted for the setting to take effect. [logfiles] -console => notice,warning,error +; Warnings and errors only. That covers what matters when a lab call +; misbehaves: failed authentication, no-matching-endpoint, playback failures. +; +; `notice` and `verbose` are both excluded because the "Remote UNIX +; connection" pairs the healthcheck generates arrive on those channels, and +; they swamped everything else (the Loki stream measured 100% healthcheck +; noise before this). The healthcheck itself is also reduced to one CLI call +; on a 60s interval in docker-compose — the two changes work together. +; +; To trace a call's dialplan execution, raise verbosity at runtime rather than +; leaving it on: +; asterisk -rx "core set verbose 3" +console => warning,error diff --git a/tests/lab/docker-compose.lab.yml b/tests/lab/docker-compose.lab.yml index dd9c750..ae9b5ef 100644 --- a/tests/lab/docker-compose.lab.yml +++ b/tests/lab/docker-compose.lab.yml @@ -21,8 +21,22 @@ services: - ./dialplan/pjsip.local.conf:/etc/asterisk/pjsip.conf:ro - ./dialplan/rtp.local.conf:/etc/asterisk/rtp.conf:ro - ./dialplan/logger.conf:/etc/asterisk/logger.conf:ro + # Carries `nocolor = yes`: without it every log line reaches Loki + # wrapped in ANSI escape codes. + - ./dialplan/asterisk.conf:/etc/asterisk/asterisk.conf:ro # The image ships no sound files at all. These are generated by # sounds/generate.py; Asterisk resolves Playback(lab-music) to # lab-music.sln here (8kHz signed-linear, no transcoding). - ./sounds:/var/lib/asterisk/sounds/en:ro + # The image's default command is `-vvvdddf` — verbosity 3 and debug 3 + # forced on the command line, which overrides both asterisk.conf and + # logger.conf. That makes every healthcheck CLI connection log a + # "Remote UNIX connection" pair: ~2900 lines/day of pure noise that + # completely buried the real SIP events in Loki. + # + # -f foreground (required: Docker needs PID 1 to stay), -T timestamps, + # -W colour off, -U run as asterisk, -p realtime priority. No -v, no -d: + # warnings and errors still log, and verbosity can be raised at runtime + # with `asterisk -rx "core set verbose 3"` when tracing a call. + command: ["/usr/sbin/asterisk", "-f", "-T", "-W", "-U", "asterisk", "-p"] restart: unless-stopped