Skip to content

New logs CLI command #410

@rabbitstack

Description

@rabbitstack

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs: docsIndicates that the issue needs documentation updatesscope: cliAnything related to CLI

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions