Skip to content

VictoriaLogs web UI: add the ability to show stream context per each log line #113

@valyala

Description

@valyala

Is your feature request related to a problem? Please describe

Web UI for VictoriaLogs displays log lines matching the given query. Sometimes it is needed to investigate surrounding log lines received from the application, which generated the given log line.

Describe the solution you'd like

It would be great if web UI for VictoriaLogs could provide show context button per each displayed log line. When this button is clicked, a popup should be displayed. The popup should contain up to 10 surrounding log lines before and after the given log line. The given log line should be highlighted, so the user could easily find it. The popup should have more lines buttons at the top and and the bottom of the displayed list of log lines. When the user clicks these buttons, additional 10 log lines must be shown in the selected direction.

This functionality can be implemented with the help of stream_context pipe. Web UI should construct the following query when the show context button is clicked on some log line:

_stream_id:<stream_id> _time:<time> | stream_context before <lines_before> after <lines_after>

Where:

  • <stream_id> is the corresponding _stream_id field value for the selected log line. If the log line doesn't contain the _stream_id field, then the line shouldn't contain the show context button.
  • <time> is the corresponding _time field field value. The <time> must be converted to canonical value with nanosecond precision if needed. For example, if the _time field value equals to 2024-09-19T14:41:13.76572Z, it must be adjusted to 2024-09-19T14:41:13.765720000Z, e.g. four zeroes must be added before the trailing Z in order to make it nanosecond precision. If the log line doesn't contain the _time field, then the line shouldn't contain the show context button.
  • <lines_before> and <lines_after> is the number of surrounding log lines to display before and after the selected log line. These values must be adjusted according to the number of clicks on show more button in the popup with surrounding log lines. The corresponding show more button must become inactive if the stream_context query with the increased <lines_before> or <lines_after> value doesn't return more log lines. This means that the stream doesn't have more log lines in the given direction.

Describe alternatives you've considered

No response

Additional information

The current implementation of stream_context pipe contains a bug, which prevents from returning surrounding log lines when _time filter points to the particular point in time with nanosecond precision. This bug will be fixed soon, and it shouldn't prevent from implementing the show context feature in VictoriaLogs web UI.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestweb-uiIssues related to the user interface: layout, styling, usability, or UI-specific bugs.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions