Skip to content

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

Merged
hassandotcms merged 2 commits into
mainfrom
35208-task-implement-log-file-listing-endpoint
May 19, 2026
Merged

feat(maintenance): add REST endpoint for log file listing #35208#35741
hassandotcms merged 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

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
Comment thread dotCMS/src/main/java/com/dotcms/rest/api/v1/maintenance/MaintenanceResource.java Outdated
Comment thread dotCMS/src/main/java/com/dotcms/rest/api/v1/maintenance/MaintenanceResource.java Outdated
…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.
@hassandotcms hassandotcms enabled auto-merge May 19, 2026 13:58
@hassandotcms hassandotcms added this pull request to the merge queue May 19, 2026
Merged via the queue into main with commit 7156fa2 May 19, 2026
49 of 51 checks passed
@hassandotcms hassandotcms deleted the 35208-task-implement-log-file-listing-endpoint branch May 19, 2026 14:57
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