{"record":{"id":"29e8d4d35040cafa","repo":"coollabsio/coolify","slug":"highlight-log-drain-is-not-enabled","errorCode":null,"errorMessage":"Highlight log drain is not enabled.","messagePattern":"Highlight log drain is not enabled\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"warning","filePath":"app/Actions/Server/StartLogDrain.php","lineNumber":71,"sourceCode":"[FILTER]\n    Name                modify\n    Match               *\n    Set                 coolify.server_name {$server->name}\n    Rename              COOLIFY_APP_NAME coolify.app_name\n    Rename              COOLIFY_PROJECT_NAME coolify.project_name\n    Rename              COOLIFY_SERVER_IP coolify.server_ip\n    Rename              COOLIFY_ENVIRONMENT_NAME coolify.environment_name\n[OUTPUT]\n    Name nrlogs\n    Match *\n    license_key \\${LICENSE_KEY}\n    # https://log-api.eu.newrelic.com/log/v1 - EU\n    # https://log-api.newrelic.com/log/v1 - US\n    base_uri \\${BASE_URI}\n\");\n            } elseif ($type === 'highlight') {\n                if (! $server->settings->is_logdrain_highlight_enabled) {\n                    throw new \\Exception('Highlight log drain is not enabled.');\n                }\n                $config = base64_encode('\n[SERVICE]\n    Flush     5\n    Daemon    off\n    Log_Level debug\n    Parsers_File  parsers.conf\n[INPUT]\n    Name              forward\n    tag               ${HIGHLIGHT_PROJECT_ID}\n    Buffer_Chunk_Size 1M\n    Buffer_Max_Size   6M\n[OUTPUT]\n    Name                forward\n    Match               *\n    Host                otel.highlight.io\n    Port                24224\n');","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/coollabsio/coolify/blob/70b9acc42467278373e00de77abb40684e25b395/app/Actions/Server/StartLogDrain.php#L53-L89","documentation":"Same defensive pattern as the New Relic guard: $type === 'highlight' was decided by is_logdrain_highlight_enabled at the top of StartLogDrain::handle(), so this inner re-check of the identical flag is an invariant assertion. It can only fire if the settings relation changes underneath the running action (concurrent save + refresh). Aborts before the Highlight Fluent Bit config (forward output to otel.highlight.io:24224) is written.","triggerScenarios":"Concurrent modification of the server's Highlight log-drain settings while the StartLogDrain job executes; programmatic calls passing a Server model whose settings were mutated mid-action.","commonSituations":"Multiple UI sessions or scripts reconfiguring log drains simultaneously with a queued restart.","solutions":["Re-run StartLogDrain once the settings are stable.","Apply settings changes while no drain start/stop job is queued.","Ensure HIGHLIGHT_PROJECT_ID and the enable flag are saved together in one request."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (! $server->settings->is_logdrain_highlight_enabled) {\n    return 'Enable the Highlight log drain (and set HIGHLIGHT_PROJECT_ID) before starting it.';\n}\nStartLogDrain::run($server);","typeGuard":"function activeLogDrainType(\\App\\Models\\Server $server): string\n{\n    $s = $server->settings;\n    if ($s->is_logdrain_newrelic_enabled) { return 'newrelic'; }\n    if ($s->is_logdrain_highlight_enabled) { return 'highlight'; }\n    if ($s->is_logdrain_axiom_enabled) { return 'axiom'; }\n    if ($s->is_logdrain_custom_enabled) { return 'custom'; }\n    return 'none';\n}","tryCatchPattern":"try {\n    StartLogDrain::run($server);\n} catch (\\Exception $e) {\n    if (str_contains($e->getMessage(), 'log drain is not enabled')) {\n        StartLogDrain::run($server->refresh()); // settings changed mid-flight; retry once\n    } else {\n        throw $e;\n    }\n}","preventionTips":["Save HIGHLIGHT_PROJECT_ID together with the enable flag in one request.","Stop the log drain before switching providers to avoid racing a queued restart.","Use $server->isLogDrainEnabled() as a cheap pre-check in UI gating."],"tags":["log-drain","highlight","fluent-bit","race-condition","settings"],"backgroundTag":"log-drain-not-configured","analyzedSha":"70b9acc42467278373e00de77abb40684e25b395","analyzedAt":"2026-08-17T01:41:01.313Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}