Geavanceerd
Zoeken inInstallatiegidsen
Zo zoek je
  • Plak een foutmelding tussen aanhalingstekens, bijv. "permission denied", om de oplossingstabel te vinden.
  • Kies een gebied en een deel van de gids (installeren, eerste instellingen, dagelijks gebruik, beveiliging, oplossingen) om direct naar de juiste stap te gaan.
  • "twee woorden" vindt precies die zin.
  • Gewone woorden vinden namen, teksten en voorbeelden.
  • ↑ ↓ bewegen · Enter openen · Esc sluiten · / zoeken
Probeer:

Gids 37Kibana · Monitoring

Install and set up Kibana

Kibana is the web interface of Elasticsearch: you search logs in Discover, build dashboards, set alerts, manage users and index lifecycle, and use Elastic Security (SIEM) and Fleet. This guide installs Kibana 9 from the Elastic repository on RHEL and Ubuntu, connects it to a secured Elasticsearch with an enrollment token, sets the encryption keys and the public URL, puts it behind Nginx with HTTPS, and shows the first searches with KQL.

  • 11 Lessen
  • 5 Commando's

Dit deel is nog niet vertaald. Je ziet de Engelse tekst.

$ als gewone gebruiker# als root (of met sudo)

37.1

Know it before you install

Kibana stores nothing big itself — it reads from Elasticsearch and keeps its own settings (dashboards, saved searches, alerts) as saved objects in Elasticsearch. A data view tells Kibana which indices to search (for example logs-*).

ItemValue
Packagekibana (same Elastic repository and version as Elasticsearch)
Servicekibana.service
Config/etc/kibana/kibana.yml
Tools/usr/share/kibana/bin/ (kibana-setup, kibana-verification-code, kibana-encryption-keys)
Logs/var/log/kibana/ and journalctl -u kibana
Port5601/tcp

What you need: a running, secured Elasticsearch (see the Elasticsearch guide) of the same version, and 2 GB RAM for Kibana.

37.2

Install on RHEL, Rocky, Alma and Fedora

With the Elasticsearch repository from the Elasticsearch guide:

dnf -y install --enablerepo=elasticsearch kibana

Commando's in deze les

37.3

Install on Ubuntu and Debian

With the Elastic apt repository from the Elasticsearch guide:

apt-get update
apt-get install -y kibana
apt-mark hold kibana

37.4

Connect Kibana to Elasticsearch

Make an enrollment token on the Elasticsearch node (valid 30 minutes) and give it to Kibana:

/usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s kibana
eyJ2ZXIiOiI5LjEuNSIsImFkciI6WyIxMC4wLjIuMTE6OTIwMCJdLCJmZ3IiOiI…
/usr/share/kibana/bin/kibana-setup --enrollment-token eyJ2ZXIiOiI5LjEuNSIsImFkciI6…
✔ Kibana configured successfully.

kibana-setup writes the Elasticsearch address, the CA certificate and a service account token into kibana.yml. (Other way: start Kibana, open the UI, paste the token, and enter the code from kibana-verification-code.)

37.5

First configuration: the settings to make first

Create the encryption keys (needed for alerts, reports and saved secrets):

/usr/share/kibana/bin/kibana-encryption-keys generate -q
xpack.encryptedSavedObjects.encryptionKey: 3f5c…
xpack.reporting.encryptionKey: 9a1b…
xpack.security.encryptionKey: 7d2e…

Add them and the rest to kibana.yml (keep the lines that kibana-setup added):

/etc/kibana/kibana.yml
server.host: "127.0.0.1"
server.port: 5601
server.publicBaseUrl: "https://kibana.example.com"
server.name: "kibana-1"
logging.appenders.file.type: file
logging.appenders.file.fileName: /var/log/kibana/kibana.log
logging.appenders.file.layout.type: json
logging.root.appenders: [default, file]
xpack.encryptedSavedObjects.encryptionKey: "3f5c…"
xpack.reporting.encryptionKey: "9a1b…"
xpack.security.encryptionKey: "7d2e…"
SettingWhy
server.host: 127.0.0.1Only Nginx (HTTPS) is public.
server.publicBaseUrlCorrect links in alerts, reports and emails; removes a warning.
The three encryption keysAlerts, reports and stored credentials work and survive restarts. Keep them in your secret store.
File loggingLogs for problems with startup and plugins.

Start Kibana and put Nginx with TLS in front:

systemctl daemon-reload
systemctl enable --now kibana
journalctl -u kibana -f
/etc/nginx/conf.d/kibana.example.com.conf
server {
    listen 443 ssl;
    server_name kibana.example.com;
    ssl_certificate     /etc/letsencrypt/live/kibana.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/kibana.example.com/privkey.pem;
 
    location / {
        proxy_pass http://127.0.0.1:5601;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
    }
}
setsebool -P httpd_can_network_connect 1
nginx -t && systemctl reload nginx

Open https://kibana.example.com and log in as elastic — then create your own users.

37.6

Users, roles and data views

In Stack Management → Users / Roles: create a role with read rights on logs-* and give it to people; admins get more. Do not share elastic.

In Stack Management → Data Views → Create: name logs-*, time field @timestamp. Now Discover shows the logs.

37.7

Daily use: search, dashboards and alerts

Search in Discover with KQL:

KQL
host.name : "web1"
log.level : "error" and service.name : "shop-api"
http.response.status_code >= 500
event.action : "ssh_login" and event.outcome : "failure"
message : "timeout" and not host.name : "test-*"
source.ip : 203.0.113.0/24
  • Dashboards: Lens visualizations of errors per service, requests per status code, top source IPs.
  • Alerts (Stack Management → Rules): "more than 50 failed logins in 5 minutes" → email, Slack, Teams or webhook.
  • Index Lifecycle Policies: see and edit ILM (delete old logs).
  • Dev Tools: run Elasticsearch API calls (GET _cluster/health) from the browser.

Real uses at work:

  • Incident search across all servers; dashboards for operations and security.
  • Elastic Security: detection rules, timelines and cases (SIEM).
  • Fleet: manage Elastic Agents on all hosts from one place.

37.8

Make it safe

Security checklist:

  • Kibana on 127.0.0.1 behind Nginx with HTTPS; never 5601 open to the internet.
  • Personal users or SSO (SAML/OIDC); elastic only for emergencies.
  • Roles with least privilege (read-only for most people; restrict indices and spaces).
  • Encryption keys set and backed up (in a secret store).
  • Same version as Elasticsearch; update both together.

37.9

Update and remove

dnf -y upgrade --enablerepo=elasticsearch kibana
apt-mark unhold kibana && apt-get install --only-upgrade -y kibana && apt-mark hold kibana
systemctl restart kibana
dnf -y remove kibana

Upgrade Elasticsearch first, then Kibana to the same version.

37.10

Fix common problems

ProblemCauseFix
Kibana server is not ready yetKibana can not reach or log in to Elasticsearch, or version mismatch.journalctl -u kibana; check elasticsearch.hosts, the CA and the token; same versions.
Enrollment token rejectedIt expired (30 minutes) or the wrong node.Make a new token with elasticsearch-create-enrollment-token -s kibana.
Warning about server.publicBaseUrlNot set.Set it to the HTTPS address.
Alerts/reports do not work: "encryption key" errorEncryption keys missing or changed.Set the three keys (same on every Kibana instance); restart.
Blank page or redirect loop behind NginxMissing headers or WebSocket upgrade.Use the proxy block above; publicBaseUrl with https.
502 from Nginx on RHELSELinux blocks the proxy.setsebool -P httpd_can_network_connect 1.
Discover shows "No results"Wrong data view or time range.Check the index pattern and the time picker (top right).

37.11

Next steps

1Kibana says "Kibana server is not ready yet". Where do you look first?

journalctl -u kibana — usually it can not reach or log in to Elasticsearch, or the versions differ.

2Why set xpack.encryptedSavedObjects.encryptionKey?

Alerts and saved credentials are encrypted with it; without a fixed key they break after a restart.

Alle commando's in dit hoofdstuk