apache/seatunnel · warning

Failed to resolve log file path: {}, error: {}

Error message

Failed to resolve log file path: {}, error: {}

What it means

LogBaseServlet.prepareLogResponse failed to read the requested log file — the catch (IOException) around path resolution/read sets HTTP 400 and logs this warning with the requested logFilePath and the error message. It means the REST log API could not serve the file (bad path, unreadable, or file gone).

Source

Thrown at seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/rest/servlet/LogBaseServlet.java:75

        String logFilePath = new File(logPath, logName).getPath();
        try {
            String canonicalLogDir = new File(logPath).getCanonicalPath();
            String canonicalFilePath = new File(logFilePath).getCanonicalPath();
            if (!canonicalFilePath.startsWith(canonicalLogDir + File.separator)
                    && !canonicalFilePath.equals(canonicalLogDir)) {
                resp.setStatus(HttpServletResponse.SC_BAD_REQUEST);
                log.warn(
                        "Path traversal attempt blocked - Requested: {}, Resolved: {}, LogDir: {}",
                        logName,
                        canonicalFilePath,
                        canonicalLogDir);
                return;
            }
            String logContent = FileUtils.readFileToStr(new File(canonicalFilePath).toPath());
            write(resp, logContent);
        } catch (IOException e) {
            resp.setStatus(HttpServletResponse.SC_BAD_REQUEST);
            log.warn("Failed to resolve log file path: {}, error: {}", logFilePath, e.getMessage());
        } catch (SeaTunnelRuntimeException e) {
            resp.setStatus(HttpServletResponse.SC_BAD_REQUEST);
            log.warn(String.format("Log file content is empty, get log path : %s", logFilePath));
        }
    }
}

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Verify the requested logFilePath exists on the target node and the filename is correct (list via the log listing endpoint first).
  2. Check the process user has read permission on the log file and its directory.
  3. Confirm you are querying the correct cluster node — worker logs live on their host, not the master.
  4. Check that log rotation hasn't removed the file; request the current active log file.

Example fix

// before
curl 'http://host:8080/logs/missing-node.log'
// after: list valid files first
curl 'http://host:8080/logs/'  # then request a file from the returned list
Defensive patterns

Strategy: validation

Validate before calling

// before requesting a log file
const files = await fetch('/logs/').then(r => r.json());
const valid = files.some(f => f.name === requestedLogName);

Prevention

When it happens

Trigger: GET on the REST log endpoint with a logFilePath that cannot be canonicalized or read: nonexistent file, directory instead of file, permission error, or path outside the log dir rejected by the path check.

Common situations: Querying logs from a node where the file does not exist (wrong node/worker); requesting rotated/deleted log files; invalid or malicious path parameters; running with a different user lacking read permission on the log directory.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/7664eced21c5bc42. Report an issue: GitHub.