{"record":{"id":"c9cd8cae5b441ad5","repo":"louislam/uptime-kuma","slug":"splunk-notification-failed-with-status-code-resu","errorCode":null,"errorMessage":"Splunk notification failed with status code ${result.status}","messagePattern":"Splunk notification failed with status code (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/notification-providers/splunk.js","lineNumber":49,"sourceCode":"                return this.postNotification(notification, title, heartbeatJSON.msg, monitorJSON, \"trigger\");\n            }\n        } catch (error) {\n            this.throwGeneralAxiosError(error);\n        }\n    }\n\n    /**\n     * Check if result is successful, result code should be in range 2xx\n     * @param {object} result Axios response object\n     * @returns {void}\n     * @throws {Error} The status code is not in range 2xx\n     */\n    checkResult(result) {\n        if (result.status == null) {\n            throw new Error(\"Splunk notification failed with invalid response!\");\n        }\n        if (result.status < 200 || result.status >= 300) {\n            throw new Error(\"Splunk notification failed with status code \" + result.status);\n        }\n    }\n\n    /**\n     * Send the message\n     * @param {BeanModel} notification Message title\n     * @param {string} title Message title\n     * @param {string} body Message\n     * @param {object} monitorInfo Monitor details (For Up/Down only)\n     * @param {?string} eventAction Action event for PagerDuty (trigger, acknowledge, resolve)\n     * @returns {Promise<string>} Success state\n     */\n    async postNotification(notification, title, body, monitorInfo, eventAction = \"trigger\") {\n        let monitorUrl;\n        if (monitorInfo.type === \"port\") {\n            monitorUrl = monitorInfo.hostname;\n            if (monitorInfo.port) {\n                monitorUrl += \":\" + monitorInfo.port;","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/louislam/uptime-kuma/blob/6b5ea0155793e666666745fb8d6fef1e829543a2/server/notification-providers/splunk.js#L31-L67","documentation":"Thrown by Splunk.checkResult when result.status exists but falls outside the 2xx success range. Splunk's Event Collector / On-Call REST endpoint returns 2xx on accepted events; anything else (401, 403, 400, 5xx) means the payload was rejected or the endpoint is misconfigured.","triggerScenarios":"Wrong or expired Splunk token (401/403), incorrect splunkRestURL pointing at a non-event-collector path (404), malformed event body (400), Splunk server down (5xx), or network proxy returning 502/504.","commonSituations":"splunkRestURL copied from the Splunk UI without the /services/collector path, token regenerated in Splunk but not updated here, or HEC disabled for the token.","solutions":["Verify notification.splunkRestURL ends with the correct HEC path (typically /services/collector/event or the Splunk On-Call REST endpoint).","Regenerate and re-paste the Splunk token; HEC tokens are shown once.","In Splunk, confirm the HEC token is enabled and the index is allowed for it (Settings > Data Inputs > HTTP Event Collector).","Reproduce the POST with curl -H 'Authorization: Splunk <token>' to see Splunk's detailed error body."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Validate URL + token shape before posting to Splunk\nfunction buildSplunkOptions(notification) {\n    if (!notification.splunkRestURL) throw new Error(\"Splunk REST URL is required\");\n    try { new URL(notification.splunkRestURL); } catch { throw new Error(\"splunkRestURL is not a valid URL\"); }\n    if (!notification.pagerdutyIntegrationKey) throw new Error(\"Splunk routing key is required\");\n    return { /* ...existing options... */ };\n}","typeGuard":"/** True when status is in the 2xx success band. */\nfunction is2xx(status) {\n    return typeof status === \"number\" && status >= 200 && status < 300;\n}","tryCatchPattern":"try {\n    const result = await axios.request(options);\n    if (!is2xx(result?.status)) {\n        throw new Error(`Splunk notification failed with status code ${result?.status}`);\n    }\n} catch (err) {\n    this.throwGeneralAxiosError(err);\n}","preventionTips":["Confirm the HEC path in splunkRestURL ends with the collector endpoint.","Rotate Splunk tokens on a schedule and update configs promptly.","Verify HEC token is enabled with the right index in Splunk settings."],"tags":["splunk","notification-provider","http-status","config","auth"],"backgroundTag":null,"analyzedSha":"6b5ea0155793e666666745fb8d6fef1e829543a2","analyzedAt":"2026-08-12T23:42:12.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}