RousselTMLEARNING

Observability

Visualizing in Kibana: Lens, dashboards and saved objects

Build visualizations with Lens, assemble interactive dashboards (filters, controls, links), and manage saved objects as code with the export and import API.

1. Lens #

The visualization editor.

Principle #

Lens suggests the right visualization when you drag a field: a time histogram for @timestamp, top values for a text field, a metric for a number. You can then change the type (bars, areas, table, gauge, heat map, pie chart) without starting over.

NeedLens visualization
Volume over timeStacked bars or areas on @timestamp
Top NSorted horizontal bars
Key indicatorMetric (with trend)
DistributionHistogram on a numeric field
Geographic distributionMaps
Formulacount(kql='http.response.status_code >= 500') / count()
Good practice: The Lens formula lets you compute ratios (error rate, cache hit rate) without precomputing in Elasticsearch.

2. Dashboards #

Interactive and shareable.

Good layouts #

  • At the top: key indicators (Metric); in the middle: trends; at the bottom: detail tables.
  • Add controls (lists of services, environments) to filter the whole dashboard.
  • Use drilldowns to go from a panel to Discover or to another filtered dashboard.
  • Organize dashboards by space (Spaces) and by tags.

3. Saved objects as code #

Export, import, versioning.

API #

# Exporter tous les dashboards et leurs dépendances
curl -s -X POST localhost:5601/api/saved_objects/_export -u elastic:$PASS \
  -H 'kbn-xsrf: true' -H 'Content-Type: application/json' \
  -d '{"type": ["dashboard"], "includeReferencesDeep": true}' > dashboards.ndjson

# Importer dans un autre Kibana (ou un autre espace)
curl -s -X POST 'localhost:5601/s/equipe-web/api/saved_objects/_import?overwrite=true' -u elastic:$PASS \
  -H 'kbn-xsrf: true' -F file=@dashboards.ndjson

Versioning the .ndjson file in Git and importing it from CI lets you promote a dashboard from staging to production and restore it after a mistake.

Good to know: The /s/<space> prefix targets a Kibana space; without a prefix, it is the default space.

Related articles

The observability trilemma: cost, completeness and performance, and how solutions resolve it

Understanding the observability trilemma (cost, data completeness, query performance), its three trade-offs, …

Kibana Maps and Canvas: geographic maps and presentations

Build maps with Kibana Maps (document, aggregation and choropleth layers, ES|QL) and dynamic presentations wi…

Machine learning in Elastic: anomaly detection and AIOps

Automatically detect abnormal behaviour: anomaly detection jobs, datafeeds, detectors, influencers, alerts, f…

Keep learning

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!