Skip to content

Logs: Unexpected format for the data source response for logs #221

Description

@matyax

Reported here, and easily reproduced with a data source instance, the produced logs response is not matching the requirements of the Logs visualizations in Grafana.

As far as I can see, it seems to be producing a data frame per log line. This has the following effects:

  • The Logs Table shows only one log line (as it can only display one data frame at a time).
  • The Logs Visualization is unable to uniquely identify individual log lines: since there's no ID field in the response, the log lines UID are generated using a combination of the refId and the index of the log line in the response. Since all data frames belong to the same refId and every log line is the first and only item of the data frame values, every log line has the uid refId_0. https://github.com/grafana/grafana/blob/main/public/app/features/logs/logsModel.ts#L452 . Since they all share the same ID, log details, linking, and a lot of other Logs visualization features can't be used.

Minimally, the data source response should contain a time field (timestamp) and a string field (log line, matching the first field with type string). Any extra fields will be shown as "fields" inside log details.

Ideally, the response should match this specification: https://grafana.com/developers/dataplane/logs

Without meeting these requirements, Grafana is unable to properly handle the logs response.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions