Reputation: 410
Scenario: The logs are in following format:
<SequenceID> <Level> <Message>
I have a requirement to sort the logs based on the SequenceID at Grafana.
Background: I am using promtail to ship logs where I create labels for SequenceID and Level. However, I am unable to find any valid visualization/transformation option (panel/widget) at Grafana Dashboard that would help me in creating a table where I can sort the log entries based on the sequenceID.
Also note: The logs are generated at microsecond level, hence can't rely on timestamp.
PS: When adding transformation "Labels to fields" for the label "SequenceID", I get below error: Pls note:
Upvotes: 1
Views: 10596
Reputation: 8263
Sort Example
Step 1: Choose a new dashboard
Step 2: Add a new panel
Step 3: query command (example: {job="localhost_logs"} |= "GGGG") and choose the switch to table
Step 4: Transform (Extract fields)
Step 5: Add transformation(Organize fields)
Upvotes: 1
Reputation: 410
Solution: Selected "Table" visualization. The transformation steps are as below:
Reduce
Mode: Series to rows
Calculations: "Step"
Enable - Label to fields
Further, I used Filter data values and Filter by name transformation stages to filter the empty rows and remove a few columns.
Upvotes: 0
Reputation: 22511
Do the following steps:
Select "Table" visualization
Select "Label to fields" transformation
Click in the "sequenceID" column name to change the order.
Upvotes: 1