Grafana loki interactive dashboard

I am using Loki as a data source to fetch the system logs. I am creating two separate dashboard one is for monitoring and one is for troubleshooting.

Now question is for troubleshooting dashboard, where I am fetching logs from the system and panel(log) will show the RAW logs. Now I need to add one more panel that will be blank at the starting, but as soon as I select particular log line from first panel (RAW log) it should update the second panel (which is blank right now) with only selected log line. and maybe further I can apply some transformation on second panel.
Example: when I select one log line, second panel will parse it as JSON and shows the result/parsed JSON on second panel.

Any way to achieve this idea?

@parpitku Second panel logic can be done using the Dynamic Text panel.

You can have a data link to set a dashboard variable in the 1st panel. Then the 2nd panel can display the line based on the variable.

Hi @mikhailvolkov Thanks for you response.
First panel I am using is log panel. Which will show log lines for selected time range.
Now If I click on any one log line, content of that whole log line should be shown in another/second panel. In that second panel maybe I can use JSON parse to show the log line in better visible way/beautify JSON.
Since I am using log panel it does not have option to set data link.

@parpitku Panels can interact only using variables or eventBus, which is not supported in the log panel.

You can see if you can replace the 1st panel with DynamicText, then it will be possible.

@mikhailvolkov If I replace my first panel with time-series and assume I am tracking result-code.
Now is it possible if I click on some point in time series graph (example time stamp as 2023-03-29 16:43:15) when I got some failure and click on data link (which is already setup), it will/should show the log line of exact same time stamp (2023-03-29 16:43:15) in log panel.

1 Like

@parpitku That’s the idea. In the data link define a variable and then data source for another panel should be able to locate the log line and display it in the 2nd panel.

@mikhailvolkov I have tried mentioned solution. What I did is, set data link in first panel with variable. Now when I click in certain point (with exact time stamp and not the time range) it redirects to other dashboard->second panel, it captures same time range of first dashboard

image

but log panel does not show the log line for exact time stamp.

What Do I need to do for - When I click on some point in time series graph, it should redirect to second panel and show the log line for exact time stamp and not the time range.

@parpitku I am not sure if you can narrow the time range in LogQL to the specific line like SQL statement. Check out the documentation.

As I mentioned before, you can display the log line with the Dynamic Text panel and filter out lines using custom Handlebars handler using JavaScript.

@mikhailvolkov In any case, would you be having some demo dashboard which can guide me achieve this using dynamic text panel and use of javascript. If yes, would it be possible to share for reference ?

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.