coollabsio/coolify · warning · Exception
Custom log drain is not enabled.
Error message
Custom log drain is not enabled.
What it means
Fourth defensive guard: $type === 'custom' was selected because is_logdrain_custom_enabled was true, so the re-check at the top of the branch cannot fail under normal flow. Reachable only via a concurrent settings mutation/refresh race. On success this branch base64-encodes logdrain_custom_config and logdrain_custom_config_parser from settings — so a race can also mean those fields were emptied mid-flight.
Source
Thrown at app/Actions/Server/StartLogDrain.php:132
Rename COOLIFY_SERVER_IP coolify.server_ip
Rename COOLIFY_ENVIRONMENT_NAME coolify.environment_name
[OUTPUT]
Name http
Match *
Host api.axiom.co
Port 443
URI /v1/datasets/\${AXIOM_DATASET_NAME}/ingest
# Authorization Bearer should be an API token
Header Authorization Bearer \${AXIOM_API_KEY}
compress gzip
format json
json_date_key _time
json_date_format iso8601
tls On
");
} elseif ($type === 'custom') {
if (! $server->settings->is_logdrain_custom_enabled) {
throw new \Exception('Custom log drain is not enabled.');
}
$config = base64_encode($server->settings->logdrain_custom_config);
$parsers = base64_encode($server->settings->logdrain_custom_config_parser);
} else {
throw new \Exception('Unknown log drain type.');
}
if ($type !== 'custom') {
$parsers = base64_encode("
[PARSER]
Name empty_line_skipper
Format regex
Regex /^(?!\s*$).+/
");
}
$compose = base64_encode('
services:
coolify-log-drain:
image: cr.fluentbit.io/fluent/fluent-bit:2.0View on GitHub (pinned to 70b9acc424)
Solutions
- Re-run StartLogDrain once the custom config and enable flag are stable.
- Save the custom config and the enable flag together, in one request.
- Validate logdrain_custom_config is non-empty before enabling the custom drain.
Defensive patterns
Strategy: validation
Validate before calling
if (! $server->settings->is_logdrain_custom_enabled) {
return 'Enable the custom log drain before starting it.';
}
if (blank($server->settings->logdrain_custom_config)) {
return 'Custom log drain needs a Fluent Bit config before it can start.';
}
StartLogDrain::run($server); Type guard
function activeLogDrainType(\App\Models\Server $server): string
{
$s = $server->settings;
if ($s->is_logdrain_newrelic_enabled) { return 'newrelic'; }
if ($s->is_logdrain_highlight_enabled) { return 'highlight'; }
if ($s->is_logdrain_axiom_enabled) { return 'axiom'; }
if ($s->is_logdrain_custom_enabled) { return 'custom'; }
return 'none';
} Try / catch
try {
StartLogDrain::run($server);
} catch (\Exception $e) {
if (str_contains($e->getMessage(), 'log drain is not enabled')) {
StartLogDrain::run($server->refresh()); // retry once after settings settle
} else {
throw $e;
}
} Prevention
- Validate the custom Fluent Bit config is non-empty before enabling the flag.
- Save logdrain_custom_config, logdrain_custom_config_parser and the enable flag in one atomic update.
- Test custom configs with a local Fluent Bit before pushing them to production servers.
When it happens
Trigger: Concurrent save that disables the custom log drain (or empties logdrain_custom_config) while the queued StartLogDrain job executes against a refreshed settings relation.
Common situations: Editing the custom Fluent Bit config in the UI while a drain restart is queued; scripts toggling drain settings in parallel.
Related errors
- New Relic log drain is not enabled.
- Highlight log drain is not enabled.
- Axiom log drain is not enabled.
- Unknown log drain type.
- Invalid Cron / Human expression for Disk Usage Check Frequen
AI-assisted analysis of coollabsio/coolify@70b9acc424 (2026-08-17).
Data as JSON: /api/errors/3ad6093d2cbe1b20.
Report an issue: GitHub.