feat(maintenance): add REST endpoint for log file listing #35208#35741
Open
hassandotcms wants to merge 2 commits into
Open
feat(maintenance): add REST endpoint for log file listing #35208#35741hassandotcms wants to merge 2 commits into
hassandotcms wants to merge 2 commits into
Conversation
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.
Contributor
|
Claude encountered an error after 0s —— View job I'll analyze this and get back to you. |
| @GET | ||
| @Path("/_logFiles") | ||
| @NoCache | ||
| @Produces({MediaType.APPLICATION_JSON}) |
Member
Member
Author
There was a problem hiding this comment.
make more sense, moving the new endpoint here in TailLogResource
| @Parameter(hidden = true) @Context final HttpServletResponse response) { | ||
|
|
||
| assertBackendUser(request, response); | ||
|
|
Member
There was a problem hiding this comment.
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 =
fabrizzio-dotCMS
requested changes
May 18, 2026
…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.
fabrizzio-dotCMS
approved these changes
May 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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