feat: improve host log management#13345
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds support for clearing host SSH login logs from the UI by introducing a new /hosts/ssh/log/clean endpoint in the agent, wiring it into routing, and updating the frontend SSH log page to trigger the operation with confirmation. It also refines system log pagination for journalctl by introducing cursor-based pagination and adjusts time formatting for broader journalctl compatibility.
Changes:
- Add “Clean logs” action to the SSH login log view with confirmation and success feedback.
- Add agent API/route/service support to clear SSH log files and update Swagger/x-panel-log docs for the new endpoint.
- Improve system log (
journalctl) pagination using__CURSORand adjust journal time formatting.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/views/host/ssh/log/log.vue | Adds a confirmation-driven “clean logs” UI action for SSH login logs. |
| frontend/src/api/modules/host.ts | Adds a frontend API wrapper for /hosts/ssh/log/clean. |
| core/cmd/server/docs/x-log.json | Documents the new clean endpoint in panel log metadata. |
| core/cmd/server/docs/swagger.json | Adds Swagger path entry for /hosts/ssh/log/clean. |
| core/cmd/server/docs/docs.go | Updates embedded Swagger template to include the new endpoint. |
| agent/router/ro_host.go | Registers the new agent route /hosts/ssh/log/clean. |
| agent/cmd/server/docs/x-log.json | Documents the new clean endpoint in agent log metadata. |
| agent/app/service/ssh.go | Implements SSH log file detection improvements and adds log-cleaning behavior. |
| agent/app/service/logs.go | Adds cursor-based pagination support for journalctl and adjusts query time formatting. |
| agent/app/dto/logs.go | Extends system log DTO to carry the journal cursor internally. |
| agent/app/api/v2/ssh.go | Exposes the new CleanSSHLogs API endpoint. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Refs #13229