Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New logs CLI command #410

Open
rabbitstack opened this issue Dec 13, 2024 · 0 comments
Open

New logs CLI command #410

rabbitstack opened this issue Dec 13, 2024 · 0 comments
Labels
needs: docs Indicates that the issue needs documentation updates scope: cli Anything related to CLI

Comments

@rabbitstack
Copy link
Owner

rabbitstack commented Dec 13, 2024

Motivation

Examining the Fibratus logs can be a hassle, especially if the end user is not familiar with Powershell. It would be much more convenient if the Fibratus CLI provided the facilities for grepping log files, filtering relevant log messages, etc.

Feature

Expand the Fibratus CLI with a new logs command. The command should ideally provide the following set of modifiers:

  • -f: tails the log file in realtime as the file gets written by the Fibratus process
  • -n: shows the last N lines of the log file
  • -h: shows the first N lines of the log file
  • -l: filters the log messages by the log level (debug, info, warning, and error)
  • --grep: accepts the Go-compatible regular expression and applies on each log line. If it produces any match, the log line is shown on the console.

If the command is run without any modifiers, the entire log file is read and dumped on the console.

Examples:

Show last 10 lines and watch for subsequent changes in realtime:

$ fibratus logs -n 10 -f

Filter logs by info level

$ fibratus logs -l info

Additional context

For watching the file changes in realtime, consider the usage of the fsnotify package.

@rabbitstack rabbitstack added needs: docs Indicates that the issue needs documentation updates scope: cli Anything related to CLI labels Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: docs Indicates that the issue needs documentation updates scope: cli Anything related to CLI
Projects
None yet
Development

No branches or pull requests

1 participant