specifications

The data source is Nginx request log. The data source is Nginx request log. The average request time, maximum request time and minimum request time are collected by URL.

After the table comes out, click the top10 url to jump to a detailed request trend chart of the corresponding url, as shown below:



Requirements are roughly such requirements, the following is the specific operation method.

A detailed example

Add Elasticsearch data source

The es index format is nginx-aggregation-log-20210125, so the following Settings are required for Elasticsearch:



Note: index name:[nginx-aggregation-log-]YYYYMMDD

Create a dashboard and panel

Configure query statement

Then change the name of the header of the table to the name we want

Configure a variable

In theory, we can set any query statement, because we can write a query statement instead of selecting a URL to dynamically draw the graph

{"find":"terms","field":"url","size":10,"query":"http_host:\"xx.xxxxom\" OR http_host:\"xxx.xxxxxx.com\""}
Copy the code

Setting this variable is what you pass in later, using this variable to dynamically draw a request graph

Add the detailed request address trend

This time we add a graph and a much simpler query as follows:

Sometimes we need to display the specific URL at the bottom of the graph, so this is the way to do it

Now that the diagram is set up, we don’t need it for the next operation, so let’s configure our table again

Add a links to the chart

throughOverridesIn theFields with nameTo select one of our table headers

Note that the URL is the name of the URL in the first column of the table, and the link added is actually the address of the dashboard in the detail request diagram just added



When we type in$A list of available variables will automatically pop up, as shown below:

Set it up, click Save, and you can do it, ha ha ha, the effect picture is as follows:

Note: If the link opens the graph in the same dashboard as the source graph, you only need to set one variable. If it is not in the same dashboard, you need to set variables in both dashboards with the same variable name.