[TASK] Implement log file listing endpoint
A pull request for this has already been merged.
- #35741 by @hassandotcms — merged
- Dominant language
- Java
- Stars
- 970
- Forks
- 486
- Avg merge
- 3d 33m
- Merged PRs (30d)
- 170
Description
Description
Implement GET /v1/maintenance/_logFiles in MaintenanceResource.java. Returns a sorted list of available log file names from the configured log directory, filtered by the configured regex pattern. The returned file names are used as the {fileName} parameter for the existing tail (/v1/logs/{fileName}/_tail) and download (/v1/maintenance/_downloadLog/{fileName}) endpoints.
Acceptance Criteria
- API caller must receive a sorted list of log file names (relative paths, not absolute)
- Files must be read from the directory configured by
TAIL_LOG_LOG_FOLDER(default./dotsecure/logs/) - Files must be filtered by the regex configured in
TAIL_LOG_FILE_REGEX— use default".*\\.log$|.*\\.out$"to matchTailLogResourcebehavior - File names must have the base log directory path stripped (return relative names only)
- List must be alphabetically sorted
- Must require backend user with admin access
Priority
None
Additional Context
- Use
FileUtil.getAbsolutlePath()to resolve relative log directory path - Use
FileUtil.getFilesByPattern(logFolder, "*.*")to get all files, then filter by regex — same approach as the JSP - Note:
tail_log.jspdefaultsTAIL_LOG_FILE_REGEXto".*"(line 37) butTailLogResourceuses".*\\.log$|.*\\.out$"(line 101). Use the TailLogResource default for consistency with the existing REST tailing endpoint - JSP legacy:
tail_log.jsplines 36–57
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in MaintenanceResource.java and compare the existing TailLogResource defaults and the legacy tail_log.jsp lines 36–57; review FileUtil.getAbsolutlePath() and getFilesByPattern(). Done means the admin-only endpoint returns alphabetically sorted, regex-filtered relative log paths from the configured directory, compatible with the existing tail and download endpoints.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 30/100