Highlight data in a table

Updated at:
Copy as MD

After collecting NGINX access logs into Simple Log Service, you can apply table highlighting rules to color-code cells or rows based on field thresholds, such as marking failed requests in red.

Prerequisites

Overview

In the Field/Column Settings panel, set the color scheme to Threshold for the status field and set Cell Display Mode to Background Highlight. For example, set a threshold of 400 so values of 400 or greater appear red and lower values appear green. With the query select request_method,status where status is not null, rows like GET/400 and POST/500 are highlighted red, while POST/200 rows are highlighted green.

  1. Query and Analysis: Query and analyze logs to retrieve or aggregate data.

  2. Add a chart: Add a table chart to a dashboard to display query results.

  3. Configure highlighting: Highlight the text, background, or entire row in a table.

Step 1: Query and analyze

  1. Log on to the Simple Log Service console. In the Projects section, click the project you want.

    image

  2. On the Log Storage > Logstores tab, click the logstore you want.

    image

  3. Enter a query statement, then click Last 15 Minutes to set the time range.

    For example, to view request methods and status codes, run the following query:

    * | SELECT request_method,status

Step 2: Add a chart

  1. In the left-side navigation pane, choose Dashboard > Dashboards. In the Dashboard list, click the dashboard you want. In the upper-right corner of the dashboard page, click Edit. In edit mode, choose Add > Add Chart.

    image

  2. In the General Configurations section, select the image icon for Chart Type. On the Query and Analysis tab, select your data source (in this case, LogStore (SQL)), select the target Logstore, and enter a query statement.

    In the upper-right corner, select a time range such as Last 15 Minutes and click Apply.

    Set Chart Type to Table. An example query: * | select *.

Step 3: Configure highlighting

Highlight cell text

  • Standard Configurations > Color Scheme > Threshold: Set the threshold-based color scheme.

  • Field/Column Settings > Cell Display Mode > Text Highlight: Apply text highlighting to the status column in Query and Analysis A.

  • Threshold > Threshold: Set the status threshold in Query and Analysis A to 400. Values where status>=400 appear red, and values where status<400 appear green.

Highlight cell background

  • Standard Configurations > Color Scheme > Threshold: Set the threshold-based color scheme.

  • Field/Column Settings > Cell Display Mode > Background Highlight: Apply background highlighting to the status column in Query and Analysis A.

  • Threshold > Threshold: Set the status threshold in Query and Analysis A to 400. Values where status>=400 appear red, and values where status<400 appear green.

In the Field/Column Settings panel, set the color scheme to Threshold for the status field and set Cell Display Mode to Background Highlight. Set a threshold of 400: values of 400 or greater appear red, and lower values appear green. With the query select request_method,status where status is not null, rows like GET/400 and POST/500 are highlighted red, and POST/200 rows are highlighted green.

Highlight entire row

  • Standard Configurations > Color Scheme > Threshold: Set the threshold-based color scheme.

  • Field/Column Settings > Cell Display Mode > Full Row Background Highlight: Apply full-row background highlighting based on the status field in Query and Analysis A.

  • Threshold > Threshold: Set the status threshold in Query and Analysis A to 400. Values where status>=400 appear red, and values where status<400 appear green.