Skip to main content

Installing and Setting Up Kibana

1. Installing Kibana

Installation Method Details Notes
Package Manager (apt/yum) sudo apt install kibana or sudo yum install kibana Available for Debian/Ubuntu and Red Hat/CentOS systems
ZIP/TAR Download from Elastic.co
tar -xzf kibana-8.12.0-linux-x86_64.tar.gz
Platform-independent, requires manual setup
Docker docker run docker.elastic.co/kibana/kibana:8.12.0 Quick deployment, ideal for dev/test environments

Example: Docker Installation

docker run -d \
  --name kibana \
  --network elastic-network \
  -p 5601:5601 \
  docker.elastic.co/kibana/kibana:8.12.0
Note: Ensure Elasticsearch is running and accessible before starting Kibana.
Warning: Kibana must be on the same network as Elasticsearch for communication.

2. Configuring Elasticsearch Connection

Property Value Description
elasticsearch.hosts ["http://localhost:9200"] Array of Elasticsearch host URLs to connect to
elasticsearch.username "" Username for Elasticsearch authentication (if enabled)
elasticsearch.password "" Password for Elasticsearch authentication (if enabled)
elasticsearch.ssl.verificationMode "full" SSL/TLS verification mode: none, certificate, or full
elasticsearch.requestTimeout 30000 Request timeout in milliseconds for Elasticsearch operations

Example: Basic Elasticsearch Connection Configuration

elasticsearch:
  hosts: ["http://localhost:9200"]
  username: "elastic"
  password: "changeme"
  ssl:
    verificationMode: full
  requestTimeout: 30000
Note: Ensure that the Elasticsearch instance is running and accessible before starting Kibana.

3. Setting Server Configuration

Property Default Value Description
server.host "localhost" Host to bind Kibana to
server.port 5601 Port to listen on for HTTP requests
server.basePath "" Base path for Kibana URLs (e.g., /kibana)
server.rewriteBasePath false Whether to rewrite the base path in responses
elasticsearch.hosts ["http://localhost:9200"] Array of Elasticsearch hosts to connect to
elasticsearch.username "" Username for authenticating with Elasticsearch
elasticsearch.password "" Password for authenticating with Elasticsearch
elasticsearch.requestTimeout 30000 Timeout (in ms) for Elasticsearch requests
elasticsearch.ssl.verificationMode "certificate" SSL verification mode for Elasticsearch connection
elasticsearch.ssl.certificateAuthorities undefined Path to CA certificate file(s) for Elasticsearch

Example: Basic Kibana server configuration

server.host: "0.0.0.0"
server.port: 5601
server.basePath: "/kibana"
elasticsearch.hosts: ["http://localhost:9200"]
elasticsearch.username: "kibana"
elasticsearch.password: "kibana"

Example: Kibana with SSL enabled

server.host: "localhost"
server.port: 5601
elasticsearch.hosts: ["https://localhost:9200"]
elasticsearch.ssl.verificationMode: "none"
Note: Ensure that the Elasticsearch host is accessible and that credentials are correctly configured for authentication.

4. Configuring Base Path

Example: Setting base_path in kibana.yml

server.basePath: "/kibana"
server.rewriteBasePath: true
Property Value Description
server.basePath /kibana Base path to use for all Kibana URLs
server.rewriteBasePath true Whether to rewrite the base path in the response headers
Note: When server.rewriteBasePath is set to true, Kibana will rewrite the base path in the response headers to ensure proper routing.

5. Setting Up Environment Variables

Example: Kibana Environment Configuration

# Set environment variables for Kibana
export KIBANA_HOME=/opt/kibana
export KIBANA_PORT=5601
export ELASTICSEARCH_URL=http://localhost:9200

# Start Kibana with environment variables
$KIBANA_HOME/bin/kibana 

Variable Description Default Value Notes
KIBANA_HOME Installation directory of Kibana /opt/kibana Must be set for Kibana to locate its configuration and binaries
KIBANA_PORT Port on which Kibana listens 5601 Can be changed to avoid port conflicts
ELASTICSEARCH_URL URL of the Elasticsearch instance http://localhost:9200 Must point to a running Elasticsearch instance
KIBANA_CONFIG_FILE Path to Kibana configuration file /etc/kibana/kibana.yml Can be overridden to load a custom config file
Note: Environment variables can be set in /etc/environment or via shell scripts for persistence across reboots.
Warning: Ensure that the KIBANA_HOME variable points to a valid installation directory; otherwise, Kibana will fail to start.

6. Starting and Stopping Services

Service Command Description
Kibana systemctl start kibana Starts the Kibana service
Kibana systemctl stop kibana Stops the Kibana service
Kibana systemctl restart kibana Restarts the Kibana service
Kibana systemctl status kibana Checks the current status of Kibana

Example: Starting Kibana service

sudo systemctl start kibana
sudo systemctl status kibana
Note: Ensure that Elasticsearch is running before starting Kibana.

7. Verifying Installation

Example: Check Kibana service status

systemctl status kibana
Check Status Description
Service Status active (running) Kibana service is running
Port Binding 5601 Kibana listens on port 5601 by default
Log File /var/log/kibana/kibana.log Check logs for startup errors or warnings
Note: Ensure that Elasticsearch is running and accessible before verifying Kibana.

Example: Access Kibana web UI

http://localhost:5601

Verification Steps

  1. Start Kibana service: systemctl start kibana
  2. Check service status: systemctl status kibana
  3. Verify port binding: netstat -tuln | grep 5601
  4. Open browser to http://localhost:5601
  5. Confirm Kibana dashboard loads without errors

8. Configuring Logging

Property Default Value Description
elasticsearch.log.level INFO Log level for Elasticsearch integration
kibana.log.level INFO Log level for Kibana application
logging.destinations stdout Where logs are written (e.g., file, stdout)
logging.appenders console Appenders to use for logging (e.g., console, file)

Example: Logging Configuration in kibana.yml

logging:
  level: debug
  appenders:
    - type: console
      layout:
        type: json
  destinations:
    - file:
        path: /var/log/kibana/kibana.log
Note: Setting logging.level to debug enables more verbose logging useful for troubleshooting.

9. Setting Up Time Zone

Configuration Option Description Default Value Notes
time.zone Defines the time zone used for date formatting and parsing in Kibana. UTC Can be set to any valid IANA time zone identifier (e.g., America/New_York, Europe/London)

Example: Configuring Time Zone in kibana.yml

time.zone: America/New_York
Note: Changing the time zone requires a restart of the Kibana service to take effect.

10. Configuring Memory Limits

Property Default Value Description
bootstrap.memory_lock false Prevents Kibana from swapping memory to disk. Set to true for production environments.
node.options [] Additional Node.js options to pass to the Kibana process. Can be used to set memory limits.

Example: Setting Memory Limits via node.options

node.options: [
  "--max-old-space-size=2048"
]
Note: The --max-old-space-size option limits the amount of memory used by the Node.js garbage collector. Adjust this value based on your system's available RAM.

Was this article helpful?