feat(logs): add chronological historical log tailing - #6153
Open
testfax wants to merge 3 commits into
Open
Conversation
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.
Summary
Adds optional chronological merging of historical log output for
pm2 logs.New flags:
pm2 logs --chronologicalpm2 logs --chronoCurrent behavior
The initial historical output from
pm2 logsis grouped by log file. Each file's last N lines are printed before moving to the next file.After the historical tail completes, realtime logs are naturally interleaved across processes.
New behavior
With
--chronologicalor--chrono, PM2:Normal
pm2 logsbehavior is unchanged.Timestamp requirements
Chronological mode requires timestamped application logs.
If an application historical log entry has no parseable timestamp, PM2 returns an error instead of inferring order from file modification times.
Non-timestamped PM2 daemon diagnostic lines are skipped.
Validation performed
node --check lib/API/Log.jsnode --check lib/API/LogManagement.jsnode --check lib/binaries/CLI.jsgit diff --checkpm2 logs --chronopm2 logs --chronologicalFull
npm testwas not run successfully on Windows because the project's test command requiresbash.Example