Kibana Guide: Time Series Charts in Lens

This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production.

Checked on 2026-11-11 against Kibana 9.5.x.

What you build

You add three Lens panels to the dashboard Bookshelf (guides). The first one draws the Bookshelf requests per minute as lines, one for each URI with the rest grouped as Other, next to a copy of the total shifted in time, a reference line and an annotation. The second one draws the 95th percentile of the latency from the traces. The third one draws the error ratio, computed by a formula and shown as a percentage.

Finished Kibana dashboard Bookshelf (guides) in view mode with four panels: requests per minute by URI as lines with a shifted copy, the 95th percentile of the latency, the error ratio and the bar chart of the first guide

Before you start

  • Start the Kibana profile of the hands-on lab and wait about a minute:

    cd lab
    docker compose --profile kibana up -d
  • Open http://localhost:5601 and sign in as elastic with the password lab-elastic-password. When Kibana opens its full-screen welcome page, click Explore on my own.

  • Do the previous guide, Create a dashboard and the first Lens panel. It creates the dashboard Bookshelf (guides) and the data view Bookshelf logs (guides) (index pattern logs-generic.otel-default, time field @timestamp) comes from Upload a file and create a data view.

  • The percentiles need a second data view for the traces. In Stack Management, open Data Views, click Create data view, type the Name Bookshelf traces (guides), the Index pattern traces-generic.otel-default and the Timestamp field @timestamp, and click Save data view to Kibana.

  • The load generator must run in its default mode, which feeds both the logs and the traces. Lens and dashboards need no licence beyond the basic one; the lab runs a trial licence anyway.

  • The guide was checked on Elasticsearch and Kibana 9.5.6. The figures are drawings of the Kibana 9.5 user interface, not screenshots, so small details can differ from your screen, and the numbers in the charts are only illustrations. A highlighted box with a number marks the control of the step with the same number. The dimension editors, the chart type menu, the Add layer menu and their settings were not all opened one by one in the lab for this guide; the figures show them in general form and the steps name the controls without describing their exact layout.

Steps

The Lens editor is the same as in the first guide: the field list at the left, the workspace in the middle and the configuration panel with the layers at the right. The map of the editor is in Create a dashboard and the first Lens panel; the figures below show the parts that this guide uses.

Open Lens from the dashboard

  1. Open the primary navigation with the menu button, click Dashboards under Analytics, and click Bookshelf (guides).

  2. Click Edit in the second bar.

    Dashboard Bookshelf (guides) of Kibana 9.5 in view mode with the bar chart panel of the first guide; the Edit button of the second bar is marked by callout 2
  3. Click Add in the second bar.

  4. In the Add to dashboard flyout, click Visualization.

    Bookshelf (guides) in edit mode with the Add to dashboard flyout open: the Add button of the second bar is marked by callout 3 and the entry Visualization of the flyout by callout 4

Draw lines, areas and bars over time

  1. Lens opens with an empty workspace. Check that the Data view picker shows Bookshelf logs (guides), then click the chart type button of the layer, which shows Bar, and choose Line.

    Empty Lens editor with the chart type button of the layer open as a menu listing Bar, Area and Line; the entry Line is marked by callout 5
  2. Drag the field @timestamp from the field list onto the dashed Horizontal axis button. Lens fills the axis with a date histogram.

  3. Drag the entry Records, above Available fields, onto the dashed Vertical axis button. Lens shows it as Count of records.

    Lens editor with a Line layer and empty axes; the field @timestamp of the list is dragged onto the Horizontal axis (callout 6) and the entry Records onto the Vertical axis (callout 7)
  4. The workspace draws the count of records over time as one line. Click the chart type button again and choose Area. The same data is now filled below the line.

    Lens editor with a line chart of Count of records over time, one line; the chart type button of the layer, showing Line, is marked by callout 8
  5. Click the chart type button and choose Bar. Compare the three shapes: a line follows a value, an area stresses the volume, bars show each interval as a separate amount.

  6. Click the chart type button and choose Line again. The rest of the guide uses lines.

Set the date histogram interval

  1. Click the Horizontal axis entry @timestamp to open its editor. Its function is the date histogram.

  2. In the editor, set the interval to 1 minute. A short interval draws more points and a noisier line, a long interval smooths the line but hides short peaks; with Last 15 minutes in the time picker, one minute is a good size.

    Dimension editor of the Horizontal axis in Lens showing the function Date histogram on the field @timestamp, with the Interval control set to 1 minute and marked by callout 12
  3. Close the editor.

Break the line down by URI

  1. Drag the field attributes.uri onto the dashed Breakdown button.

    Lens editor with the count of records over time as one line; the field attributes.uri of the list is dragged onto the dashed Breakdown button of the layer, which is marked by callout 14
  2. Click the new Breakdown entry to open its editor. The function is Top values: one line for each of the most frequent values of the field.

  3. Set the number of values to 2, so that only the two busiest URIs get a line.

  4. Turn on the switch for the group Other, so that the requests of all the remaining URIs are added together as one more line called Other.

    Dimension editor of the Breakdown in Lens with Top values on attributes.uri; the Values control set to 2 is marked by callout 16 and the Other switch, turned on, by callout 17; the chart behind shows three lines
  5. Close the editor.

Add a second layer, reference lines and an annotation

A layer is one set of axes of its own inside the same chart. Reference lines and annotations are layers too.

  1. Click Add layer at the top of the configuration panel.

  2. Choose the entry for a data layer.

    Lens editor with the Add layer button of the configuration panel open as a menu listing Layer, Reference line and Annotations; the button is marked by callout 19 and the entry Layer by callout 20
  3. In the new layer, drag @timestamp onto its dashed Horizontal axis button.

  4. Drag Records onto its dashed Vertical axis button.

  5. Click the new Vertical axis entry, Count of records, to open its editor.

  6. In the editor, type 10m in the Time shift control. The layer now draws the total number of requests as it was ten minutes earlier, so you can compare it with the present lines. In a lab that has run for weeks, 1w compares with the same time a week earlier.

    Dimension editor of the Vertical axis of the second layer in Lens with the function Count on Records; the Time shift control, typed 10m, is marked by callout 24; the chart behind shows the lines of the first layer and a second line that is shifted in time
  7. Close the editor, click Add layer again and choose the entry for a reference line.

  8. In the editor of the reference line, select the Static value tab and type 500, the number of requests per minute that you do not want to exceed.

    Reference line editor in Lens with the tab Static value selected and the value 500 typed in the Value control, which is marked by callout 26; the tabs Quick functions and Formula are next to it
  9. To draw the average instead of a fixed number, close the editor, add another reference line, open its Formula tab and type:

    overall_average(count())
  10. Click Add layer once more and choose the entry for annotations.

  11. In the editor of the annotation, type failing mode on in the Label control.

  12. Set the Time control to the moment the annotation marks, for example the minute when you will switch the load generator to its failing mode in the check below.

    Annotation editor in Lens with the Label control typed failing mode on, marked by callout 29, and the Time control with a date and time, marked by callout 30
  13. Click Save and return in the second bar.

Draw percentiles of the latency

The logs have no duration, but the traces do, so this panel uses the second data view.

  1. Back on the dashboard, click Add and then Visualization.

  2. In Lens, choose the chart type Line.

  3. Open the Data view picker and choose Bookshelf traces (guides).

  4. Drag @timestamp onto the dashed Horizontal axis button.

  5. Drag the field attributes.transaction.duration.us, the duration of the transactions in microseconds, onto the dashed Vertical axis button.

  6. Click the new Vertical axis entry and choose the function Percentile for the field.

  7. Type 95 as the percentile. Type p95 of duration.us in the name control if you want the short label of the figure. The line shows the duration below which 95 percent of the transactions finish. Add the 50th percentile and the 99th in the same way if you want to compare the typical and the worst cases.

    Lens editor on the data view Bookshelf traces (guides) with the dimension editor of the Vertical axis: the function Percentile is marked by callout 37 and the percentile value 95 by callout 38
  8. Close the editor and click Save and return.

Compute the error ratio with a formula

  1. Click Add and then Visualization once more.

  2. In Lens, choose the chart type Line and open the Data view picker to choose Bookshelf logs (guides) again.

  3. Drag @timestamp onto the dashed Horizontal axis button.

  4. Click the dashed Vertical axis button and open the Formula tab of its editor.

  5. Type the formula that divides the number of log records with the severity ERROR by the number of all records:

    count(kql='severity_text : "ERROR"') / count()
    Dimension editor of a new Lens chart with the tab Formula selected: the formula that divides the ERROR records by all records is typed in the editor (callout 44) and the Value format control is set to Percent (callout 45)
  6. Set the Value format control to Percent, so that the axis and the tooltip show 5% instead of 0.05.

  7. Type Error ratio in the name control of the editor, so that the chart shows that label instead of the formula.

  8. For the week-over-week change, a second Vertical axis entry with this formula and the same value format draws how much the number of requests grew compared with the same time a week earlier. In the lab, use 10m instead of 1w, because the lab has no week of data:

    count() / count(shift='1w') - 1
  9. Close the editor and click Save and return.

  10. Back on the dashboard, click Save in the second bar.

  11. Click Exit edit.

Check the result

Open Dashboards and then Bookshelf (guides). It must show the lines of the requests per minute with the shifted copy and the reference line, the percentile of the latency, and the error ratio, which is close to 0% in the normal mode.

To see the error ratio and the annotation react, force errors and press Refresh:

curl -X POST localhost:8090/mode/failing

Within about a minute the error ratio rises and the lines of the URIs change. Restore normal traffic afterwards:

curl -X POST localhost:8090/mode/normal

Variations

  • Replace the percentile of the traces by the average or the maximum of the same field and compare the shapes.

  • Break the first panel down by attributes.status instead of attributes.uri to see the share of the 404 responses over time.

What can go wrong

Symptom Cause Fix

The workspace says that no results were found

The time picker covers Last 15 minutes and the load generator is stopped, or the lab started a moment ago.

Widen the time picker to Last 1 hour, check the mode with curl localhost:8090/, and send curl -X POST localhost:8090/mode/normal if it is not normal.

The data view Bookshelf traces (guides) is not in the picker

The data view was not created.

Create it as described in Before you start, then reopen the editor.

The shifted line is empty

The time shift is longer than the data that Elasticsearch holds, or the time picker does not cover it.

Use a shift shorter than the age of the lab data, such as 10m, and a time picker of at least Last 1 hour.

The formula shows a red error

A function name or a quote is mistyped, or the formula mixes a field of the logs with a data view of the traces.

Retype the formula with the quotes as shown, and check that the data view of the layer is Bookshelf logs (guides).

The error ratio stays at 0% in the normal mode

There are no log records with the severity ERROR in the time range.

Switch the load generator to its failing mode as in Check the result.

Clean up

Keep the dashboard and the panels: the following guides in this series extend it. The data view Bookshelf traces (guides) can stay too; delete it in Stack Management under Data Views when you no longer need it. Stopping the profile with docker compose --profile kibana down -v deletes the volumes and therefore all of them.

Where to go next