dotCMS / dotCMS/core

[TASK] Implement log file listing endpoint

Open
#35,208 1 comment 0 reactions 0 assignees View on GitHub

A pull request for this has already been merged.

  • #35741 by @hassandotcms — merged
Team : Modernization
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 match TailLogResource behavior
  • 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.jsp defaults TAIL_LOG_FILE_REGEX to ".*" (line 37) but TailLogResource uses ".*\\.log$|.*\\.out$" (line 101). Use the TailLogResource default for consistency with the existing REST tailing endpoint
  • JSP legacy: tail_log.jsp lines 36–57

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.