Configuring Butler SOS Logging
Butler SOS can log its activities to console and disk files.
Log files can be useful for retrospective troubleshooting of Butler SOS.
What's This?
Butler SOS continuously logs what it's doing. Logging is always done to console and optionally also to disk files.
The top level section Butler-SOS in the config file has a set of settings that control logging.
Log level (verbosity) can be set, logging to disk can be enabled/disabled and the directory where log files are stored can be set.
Log level can also be set on the command line when starting Butler SOS, using the --loglevel option.
Log files are kept for 30 days, after which they are automatically deleted.
For information on crash dump files that Butler SOS can create when it encounters unrecoverable errors, see Crash Dump.
Understanding Log Messages
Butler SOS produces various log messages during operation. Messages containing (chunk X/Y, points A-B) relate to InfluxDB write operations. The chunk/points notation and retry logic apply to all InfluxDB versions (1.x, 2.x, 3.x).
For a detailed explanation of what "chunk" and "points" mean, see the InfluxDB concepts page.
Settings in Main Config File
Butler-SOS:
...
...
# Logging configuration
logLevel: info # Log level. Possible log levels are silly, debug, verbose, info, warn, error
fileLogging: true # true/false to enable/disable logging to disk file
logDirectory: log # Folder where log files are stored: a relative path or a full path
...
...| Setting | Template value | Description |
|---|---|---|
Butler-SOS.fileLogging | true | Write log files to disk. When false, no log files are written. |
Butler-SOS.logDirectory | log | Folder for the log files: a relative path or a full path. |
Butler-SOS.logLevel | info | Which messages are logged. At verbose, debug and silly, Butler SOS also prints the log folder it uses when it starts. |
Butler SOS writes one log file per day, named butler-sos.YYYY-MM-DD.log, and removes files older than 30 days.
Where log files go
Changed in 15.1.2
Before Butler SOS 15.1.2, a full path in logDirectory was added onto the end of the Butler SOS folder. See Before you upgrade if you set logDirectory to a full path, or to a path that starts with / or \.
You can set logDirectory to a full path, such as /var/log/butler-sos on Linux or D:\Logs\Butler SOS on Windows, and Butler SOS writes its log files to exactly that folder. Relative paths, including the default log, start from the Butler SOS folder.
How Butler SOS finds the log folder
A full (absolute) path is used exactly as written.
- Linux and macOS: the path starts with
/, for example/var/log/butler-sos. - Windows: the path starts with a drive letter, for example
D:\Logs\Butler SOSorD:/Logs/Butler SOS. A path that starts with\or/but has no drive letter, such as\Logs, is also a full path: it points to that folder at the root of the current drive.
A relative path starts from the Butler SOS folder.
- When you run the Butler SOS executable (the usual setup on Windows and Linux servers), a relative path starts from the folder that contains the executable. The default
logmeans alogfolder next to the executable. - When Butler SOS is started with Node.js from its source code, a relative path starts from the working directory. This is how the official Docker image runs Butler SOS, with
/nodeappas the working directory, so the defaultlogmeans/nodeapp/loginside the container.
Missing folders are created. When Butler SOS starts, it creates the log folder and any missing parent folders.
Configuration examples
Linux and macOS
Butler-SOS:
fileLogging: true
logDirectory: /var/log/butler-sosWindows
Forward slashes work on Windows and avoid every quoting pitfall, so they are the simplest choice:
Butler-SOS:
fileLogging: true
logDirectory: D:/Logs/Butler SOSBackslashes work too, either without quotes or inside single quotes:
logDirectory: D:\Logs\Butler SOS logDirectory: 'D:\Logs\Butler SOS'Do not put a Windows path in double quotes. Inside double quotes, YAML treats a backslash as the start of a special character code. Depending on the letters after each backslash, Butler SOS either cannot read the configuration file at all, or silently reads a different path than the one you wrote:
logDirectory: "D:\Logs\Butler SOS" # Wrong: the config file fails to load with an "escape sequence" error
logDirectory: "C:\temp\new-logs" # Wrong: \t and \n turn into a tab and a line breakIn the second case, if file logging is on, Butler SOS stops during startup with an error that names Butler-SOS.logDirectory and ends in Your path or filename contain an invalid character. With file logging off, nothing complains: the wrong path goes unnoticed until you turn file logging on.
Docker
Inside a container, every path refers to the container's own file system. The default log is /nodeapp/log inside the container, and the sample Docker Compose files map it to a folder on the host:
volumes:
- './log:/nodeapp/log'If you set logDirectory to a full path instead, mount your volume at that same path inside the container. Otherwise the log files stay inside the container and are lost when it is removed.
Since Butler SOS 15.4.0 the container also starts without a volume at /nodeapp/log. See Log files and crash dumps in the container.
Before you upgrade
These steps matter when upgrading from a version before 15.1.2.
| Butler SOS folder | logDirectory | Log files went to (before 15.1.2) | Log files go to (now) |
|---|---|---|---|
/opt/butler-sos | /var/log/butler-sos | /opt/butler-sos/var/log/butler-sos | /var/log/butler-sos |
C:\Program Files\Butler SOS | D:\Logs\Butler SOS | C:\Program Files\Butler SOS\D:\Logs\Butler SOS (not a valid Windows path) | D:\Logs\Butler SOS |
/opt/butler-sos | log | /opt/butler-sos/log | /opt/butler-sos/log (unchanged) |
On Linux and macOS this was easy to miss. Butler SOS created the unexpected subfolder and wrote its logs there without any error, so the folder you had configured simply stayed empty.
Check for a leading slash you did not mean. Until 15.1.2,
logDirectory: /log(or\logon Windows) behaved likelog: a folder inside the Butler SOS folder. Now it means alogfolder at the root of the disk (on Windows, the root of the current drive). If that is not what you want, remove the leading slash. If you miss one and Butler SOS cannot create that folder, the startup error in step 3 names the setting and points this out.Collect your existing log files. If you had set a full path, your existing log files are in the unexpected subfolder described above, for example
/opt/butler-sos/var/log/butler-sos. After the upgrade, new log files go to the folder you configured. Move or archive the old files as needed, then delete the old subfolder. Butler SOS no longer writes there, and its automatic removal of log files older than 30 days no longer covers it.Make sure Butler SOS can create and write to the folder. The account Butler SOS runs as (for example the Windows service account, or the user of a systemd service) needs permission to create the folder, if it does not exist yet, and to write files in it. If it cannot, Butler SOS stops during startup with an error like this:
FATAL: Uncaught exception – writing crash dump… Cannot write log files to "/var/log/butler-sos", set by Butler-SOS.logDirectory: EACCES: permission denied, mkdir '/var/log/butler-sos/'. Absolute paths are used as given; for a folder inside the Butler SOS folder, use a relative path such as "log". The user Butler SOS runs as needs permission to create and write that folder. In the Docker image that user is "node", uid 1000, so a folder mounted there from a Linux host must be writable by uid 1000.- The first folder in the message is the log folder Butler SOS worked out from your setting.
- The folder after
mkdiris the first one Butler SOS could not create. It may be a parent of the folder you configured. - The hint about absolute paths appears only when the setting is an absolute path, and the hint about permissions only when the cause is
EACCESorEPERM. - The error code depends on the cause.
EACCES(permission denied) is the most common; a read-only disk givesEROFSinstead. - Butler SOS then exits with code 1 and writes a crash dump to its crash dump folder. Under an automatic restart policy (Docker
restart: on-failure, systemdRestart=on-failure) it will keep restarting and failing until the folder problem is fixed.
Checking where Butler SOS writes its logs
Start Butler SOS with log level verbose or debug. Either set logLevel in the configuration file, or add --loglevel verbose to the command line. Near the start of the output you will see:
Log file directory: /var/log/butler-sosThis line shows the folder Butler SOS has worked out from your setting. It is written to the console (or wherever your service manager collects console output), not to the log file itself.
Good to know
~is not expanded.~/logsdoes not mean your home folder. It is treated as a relative path, and creates a folder literally named~inside the Butler SOS folder. Write the full path instead.- Network shares are untested. Paths such as
\\server\share\logshave not been tested as a log folder. Use a local folder. - Crash dumps follow different rules. The crash dump folder (
crashFile.crashFileDirectory) is a separate setting. A relative path there starts from the working directory, not from the folder containing the executable. Both settings accept full paths. - Log file names and retention are unchanged. Butler SOS writes one file per day, named
butler-sos.YYYY-MM-DD.log, and removes files older than 30 days.
Console output
Colour only in a terminal
Changed in 15.5.0
Before Butler SOS 15.5.0, the console log levels were always coloured, so colour codes ended up in service logs, docker logs and redirected output.
Butler SOS colours the log level of each line it prints to the console: info green, warn yellow, error red. It does so only when the console is a terminal that shows colour. Wherever its output is saved instead, the lines are plain text.
That covers:
- the Windows service log,
service\logs\butler-sos-service.out.log; docker logs, and Docker log drivers that ship the container's output elsewhere;- a systemd journal, or any other service manager that collects the output;
- output redirected to a file, or piped into another program.
Butler SOS's own log files (Butler-SOS.fileLogging) are not affected. They have never had colour.
Colour on a terminal is made with control codes mixed into the text. A terminal turns them into colour and hides them. A log file or log viewer shows them as they are, so every line carried clutter around its log level.
Before, in the Windows service log or in docker logs:
2026-11-30T17:36:24.453Z [32minfo[39m: CONFIG: UDP queue managers initialized
2026-11-30T17:36:24.454Z [32minfo[39m: ERROR TRACKER: Initialized error tracking with daily UTC resetSome viewers show the first character of each code as ESC, ^[ or a small box.
Now:
2026-11-30T17:36:24.453Z info: CONFIG: UDP queue managers initialized
2026-11-30T17:36:24.454Z info: ERROR TRACKER: Initialized error tracking with daily UTC resetStarted from a command prompt, PowerShell or a terminal window, Butler SOS looks the same as before, with coloured log levels.
This also makes the logs easier to search. A search for error: now finds error lines in the service log and in docker logs; before, the colour codes sat between error and the colon.
When lines are coloured
| How Butler SOS runs | Console log levels coloured? |
|---|---|
| In a terminal window, command prompt or PowerShell | Yes |
| As a Windows service | No |
In Docker, read with docker logs | No |
In Docker, started with docker run -t (or tty: true in Docker Compose) | Yes |
| Output redirected to a file or piped to another program | No |
In a terminal with NO_COLOR set (and FORCE_COLOR not set), or with TERM=dumb | No |
With docker run -t or tty: true, the container's output is a terminal, so docker logs shows the colour codes, as before. Remove -t or tty: true to get plain lines in docker logs.
Turning colour off in a terminal
Set the environment variable NO_COLOR to any value, for example NO_COLOR=1. Butler SOS then writes plain lines to the terminal too. FORCE_COLOR=0 does the same.
FORCE_COLOR takes precedence over NO_COLOR: if FORCE_COLOR is set to a colour level such as 1, 2 or 3, NO_COLOR is ignored, lines stay coloured, and Node.js prints this warning at startup:
Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.To turn colour off, unset FORCE_COLOR or set it to 0.
There is no way to turn colour on where the output is not a terminal. FORCE_COLOR=1 does not do it.
There is no config setting for this. The behaviour follows from where Butler SOS's output goes.
One line per error in Docker
Changed in 15.1.2
Before Butler SOS 15.1.2, almost every error logged by Butler SOS in Docker was followed by a stack trace.
When Butler SOS runs in Docker, error messages in the log are one line each. They do not carry a stack trace — the block of at ... lines naming source files and line numbers inside Butler SOS.
This is how the standalone Butler SOS executables (Windows, macOS, Linux) have always logged errors. Docker behaves the same way.
A stack trace shows which code was running when an error happened. It is useful to someone working on Butler SOS itself, and rarely to anyone running it. Butler SOS in Docker used to add one to almost every error, because the Docker image runs Butler SOS from its source code, and stack traces were tied to that.
During an outage — InfluxDB down, say, or a Qlik Sense server not answering — that made the container log hard to read: each error took ten lines or more, and the messages that mattered were spread thin.
Before, in a Docker log:
error: HEALTH: Error when calling health check API for server 'sense1' (192.168.100.109:4747): timeout of 5000ms exceeded
error: Stack trace: AxiosError: timeout of 5000ms exceeded
at createTimeoutError (file:///nodeapp/node_modules/axios/lib/adapters/http.js:597:16)
at RedirectableRequest.handleTimeout (file:///nodeapp/node_modules/axios/lib/adapters/http.js:1320:17)
at RedirectableRequest.emit (node:events:509:28)
at Timeout._onTimeout (/nodeapp/node_modules/follow-redirects/index.js:233:12)
at listOnTimeout (node:internal/timers:635:17)
at process.processTimers (node:internal/timers:571:7)
at Axios.request (file:///nodeapp/node_modules/axios/lib/core/Axios.js:46:41)
at async getHealthStatsFromSense (file:///nodeapp/src/lib/healthmetrics.js:77:26)Now:
error: HEALTH: Error when calling health check API for server 'sense1' (192.168.100.109:4747): timeout of 5000ms exceededThe error message itself — what went wrong, and with which server — is unchanged.
Where stack traces still appear
| Where | Stack traces? |
|---|---|
| Docker | No |
| Standalone executables | No (as before) |
| Butler SOS started from its source code with Node.js, outside a container | Yes (as before) |
| Crash dump files, written when Butler SOS stops because of an unrecoverable error | Yes (as before) |
Log level debug, for some errors while setting up the InfluxDB connection | Yes (as before) |
There is no setting to turn stack traces back on in Docker. If you are asked for one in a bug report, the crash dump file is the place to look; see the crash dump settings (Butler-SOS.crashFile).
How Butler SOS knows it runs in Docker
Docker puts a file named /.dockerenv in every container it starts, and Butler SOS checks for it. The result is shown near the top of the log at every start:
info: Running in Docker : trueSome other container platforms — Podman, and Kubernetes clusters that run containers without Docker — do not create that file. There, the line above says false, and Butler SOS still logs stack traces as before.