Skip to content

feat(maintenance): add REST endpoint for log file listing #35208#35741

Open
hassandotcms wants to merge 2 commits into
mainfrom
35208-task-implement-log-file-listing-endpoint
Open

feat(maintenance): add REST endpoint for log file listing #35208#35741
hassandotcms wants to merge 2 commits into
mainfrom
35208-task-implement-log-file-listing-endpoint

Conversation

@hassandotcms
Copy link
Copy Markdown
Member

@hassandotcms hassandotcms commented May 18, 2026

Adds GET /api/v1/maintenance/_logFiles which returns a sorted, regex-filtered list of names The names are used as the {fileName} path parameter for the existing tail and download endpoints, replacing the JSP scriptlet that populated the legacy log-files dropdown.

This PR fixes: #35208

Adds GET /api/v1/maintenance/_logFiles which returns a sorted, regex-filtered
list of names from the configured TAIL_LOG_LOG_FOLDER. The names are used as
the {fileName} path parameter for the existing tail and download endpoints,
replacing the JSP scriptlet that populated the legacy log-files dropdown.

- Reuses assertBackendUser() (requiredBackendUser + requireAdmin + Maintenance
  portlet) for auth, matching the rest of the resource.
- Uses the TailLogResource default regex (.*\.log$|.*\.out$) rather than the
  JSP's ".*", so the listing matches what /api/v1/logs/{fileName}/_tail will
  actually accept.
- Returns ResponseEntityListStringView so Swagger gets a concrete List<String>
  schema.
- Returns 200 with an empty list when the configured folder is missing, so the
  UI dropdown stays functional under misconfiguration.
- Integration tests sandbox the scan via a temp directory and override
  TAIL_LOG_LOG_FOLDER, restoring it in finally — never touches the real
  dotsecure/logs path.
@hassandotcms hassandotcms linked an issue May 18, 2026 that may be closed by this pull request
@github-actions github-actions Bot added the Area : Backend PR changes Java/Maven backend code label May 18, 2026
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 18, 2026

Claude encountered an error after 0s —— View job


I'll analyze this and get back to you.

@hassandotcms hassandotcms marked this pull request as ready for review May 18, 2026 22:55
@GET
@Path("/_logFiles")
@NoCache
@Produces({MediaType.APPLICATION_JSON})
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have a TailLogResource

@path("/v1/logger")
@tag(name = "System Logging", description = "System logging configuration and management")
public class LoggerResource

I think the new methods should probably live there

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make more sense, moving the new endpoint here in TailLogResource

@Parameter(hidden = true) @Context final HttpServletResponse response) {

assertBackendUser(request, response);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look at this:

@get
@path("/{fileName:.+}/_tail")
@Jsonp
@nocache
@produces(SseFeature.SERVER_SENT_EVENTS)
public final EventOutput getLogs(@context final HttpServletRequest request,
@PathParam("fileName") final String fileName, @QueryParam("linesBack") final int linesBack) throws IOException {

    final InitDataObject initData =

…35208

Addresses review feedback: co-locate log file listing next to the existing
tail endpoint so /v1/logs becomes a coherent collection resource.

  GET /v1/logs                      list available log files (moved)
  GET /v1/logs/{fileName}/_tail     tail one log file (existing)

The endpoint keeps its admin + Maintenance portlet auth — same security
perimeter as the JSP it replaces. This is stricter than the existing
_tail method on the same resource (back-end user only); the asymmetry is
intentional and noted in javadoc. _downloadLog and _downloadClusterLog
remain in MaintenanceResource, untouched by this change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area : Backend PR changes Java/Maven backend code

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[TASK] Implement log file listing endpoint

2 participants