New `logs` CLI command

Abierto
#410 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
45/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
go
Área
cli

Línea de trabajo

Start by locating the Fibratus CLI command definitions and how the project reads its log file; the issue does not name specific files or tests. Check how existing commands parse flags, then identify the log path and available log format. Done means fibratus logs supports the requested modifiers and prints matching lines, with realtime tailing when -f is used.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

needs: docs scope: cli

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.

Lenguaje dominante
Go
Estrellas
2.6k
Forks
222
Merge medio
16 h 23 min
PR fusionados (30 d)
11

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de rabbitstack/fibratus

Todos los issues de rabbitstack/fibratus

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.