coollabsio/coolify · warning · Exception
New Relic log drain is not enabled.
Error message
New Relic log drain is not enabled.
What it means
Defensive guard in StartLogDrain: $type is derived at the top of handle() (lines 17-27) from the very same settings flag is_logdrain_newrelic_enabled, so by the time $type === 'newrelic' is true the flag re-check should always pass. In practice this branch is unreachable unless the Server's settings relation is mutated or reloaded from the database between type detection and the guard (a concurrent settings save from another request/job). When it fires, Fluent Bit config generation aborts before any container starts.
Source
Thrown at app/Actions/Server/StartLogDrain.php:36
$type = 'newrelic';
} elseif ($server->settings->is_logdrain_highlight_enabled) {
$type = 'highlight';
} elseif ($server->settings->is_logdrain_axiom_enabled) {
$type = 'axiom';
} elseif ($server->settings->is_logdrain_custom_enabled) {
$type = 'custom';
} else {
$type = 'none';
}
if ($type !== 'none') {
StopLogDrain::run($server);
}
try {
if ($type === 'none') {
return 'No log drain is enabled.';
} elseif ($type === 'newrelic') {
if (! $server->settings->is_logdrain_newrelic_enabled) {
throw new \Exception('New Relic log drain is not enabled.');
}
$config = base64_encode("
[SERVICE]
Flush 5
Daemon off
Tag container_logs
Log_Level debug
Parsers_File parsers.conf
[INPUT]
Name forward
Buffer_Chunk_Size 1M
Buffer_Max_Size 6M
[FILTER]
Name grep
Match *
Exclude log 127.0.0.1
[FILTER]
Name modifyView on GitHub (pinned to 70b9acc424)
Solutions
- Simply re-run StartLogDrain after the settings change settles — the flags and type will agree again.
- Serialize settings changes: disable/stop the log drain before toggling provider settings.
- If it fires repeatedly, look for code that saves ServerSettings without coordinating with running drain jobs.
Defensive patterns
Strategy: validation
Validate before calling
$settings = $server->settings()->first(); // fresh read at dispatch time
if (! $settings->is_logdrain_newrelic_enabled) {
return 'Enable the New Relic log drain (and set LICENSE_KEY/BASE_URI) before starting it.';
}
StartLogDrain::run($server->refresh()); 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')) {
// settings raced a concurrent save; re-read settings and retry once
StartLogDrain::run($server->refresh());
} else {
throw $e;
}
} Prevention
- Treat the drain type flags as one atomic settings save; don't toggle providers while a drain restart is queued.
- Call $server->isLogDrainEnabled() (Server model) before dispatching StartLogDrain.
- Avoid concurrent UI sessions editing the same server's log-drain settings.
When it happens
Trigger: A concurrent request or queued job toggles the server's New Relic log-drain setting (and the model relation gets refreshed) while a StartLogDrain job is executing on the 'high' queue; or custom code calls handle() with a Server instance whose settings were changed mid-flight.
Common situations: Two admins/tabs reconfiguring log drains while a drain restart is queued; Livewire re-render racing a queued job.
Related errors
- Highlight log drain is not enabled.
- Axiom log drain is not enabled.
- Custom 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/b435ff76dc0f2abb.
Report an issue: GitHub.