Run Kibana as service on CentOS

(Matt Stibbs) #1

Hi there,

I am trying to get Kibana up and running on Centos. Following the instructions on the elastic site, I can successfully download the files and run in the console.

But is there any guidance anywhere that helps me get this set up to run as a service for a production environment?

Any help appreciated.


Kibana logs?
Logstash in RH setup documentation from tar
(Mark Walkom) #2

We're working on that, as part of providing KB4 packages.

In the meantime it's pretty simple to build an init script to handle it, just copy an existing one and modify it :slight_smile:

(Matt Stibbs) #3

OK - thanks! :smile:

(Jeffrey Ollie) #4

Here's the systemd service file I'm using on my CentOS 7 systems for Kibana 4.1:

Description=Kibana 4

ExecStart=/opt/kibana-{{ kibana_version }}/node/bin/node /opt/kibana-{{ kibana_version }}/src/bin/kibana.js


(Jeffrey Ollie) #5

Here's the service file that I use on CentOS 7 to run Kibana 4.1:

Description=Kibana 4

ExecStart=/opt/kibana-4.1.0/node/bin/node /opt/kibana-4.1.0/src/bin/kibana.js


(Matt Stibbs) #7

Thank you - this is working great :smile:

(Jeffrey Ollie) #8

For the record, you'd put it into "/etc/systemd/system/kibana.service". Whenever changing systemd unit files it's a good idea to do:

systemctl daemon-reload

Then you can start the service with:

systemctl start kibana

(Matt Stibbs) #9

Thanks Jeffrey :slight_smile:

(Eugene Glotov) #10

Hello, Jeffrey.

I'm trying to run Kibana with this setup guide

In this case I don't have file src/bin/kibana.js in extracted folder. How I can register the systemctl service with /opt/kibana-4.3.1/bin/kibana run command?

Thank you

Up: OK. I'm already found this init script with instruction.

(Jeffrey Ollie) #11

Elastic changed things around in the latest releases. If you'd prefer a native systemd unit file (and who wouldn't!) here's my current one:

Description=Kibana 4

ExecStart=/opt/kibana/4.3.1/node/bin/node /opt/kibana/4.3.1/src/cli


(Eugene Glotov) #12

Thank's again, Jeffrey.

I'll try to check your new config.


Hello Jeffrey,
Can you help for adding this service to autorun for kibana service start after a system was reboot?

(Rafal) #14

Hi there,

I am not sure if this is still valid discussion, if not please just delete this post.

If you are interested in systemd, this is how I do it (including start after a reboot).

  1. /opt/kibana is a symbolic link to /opt/kibana-4.5.1-1
    which makes it very easy to upgrade/downgrade (you can create kibana_current) if you are using rpm/deb packages.

  2. rsyslog (default in Redhat) /etc/rsyslog.d/kibana.conf:

$umask 0000
$fileOwner kibana
$dirOwner kibana
$dirCreateMode 0755
$fileCreateMode 0444

if $programname == 'kibana' and $syslogfacility-text == 'local7' /var/log/kibana/kibana.log

  1. Systemd file: /etc/systemd/system/kibana.service


ExecStart=/opt/kibana/bin/../node/bin/node --max-old-space-size=512 /opt/kibana/bin/../src/cli


  1. then enable in systemd:
    systemctl enable kibana
  2. and finally start kibana:
    systemctl start kibana
  3. and optionally check the status:
    systemctl status kibana

*please execute all commands as root

  1. Optionally you can add logrotate to rotate the log file under /var/log/kibana/kibana.log

I hope it helps!


(Mark Walkom) #15

The latest versions of KB all come with an init script.

(Rafal) #16

Hi Mark,

I agree,

  • but how do you get logs from in a separate place (not 'messages')?
  • you cannot easily pass NODE_OPTIONS because /opt/kibana/bin/kibana is not including it, you have to add at the end but before 'exec': [ -r /etc/default/kibana ] && . /etc/default/kibana

(Just Insane) #17

Old topic, I know. If I should create a new topic, please let me know.

I am trying to get kibana to output logs to /var/log/kibana/kibana.log so that I can process the http response codes better (using logstash filters), however, I can't get kibana to load after editing kibana.yml. It works when I use /opt/kibana/bin/kibana, and the logs go to the correct file, however, when I try to use the systemd file that comes with kibana, systemd says that everything is working fine, but I am unable to get kibana to load at all.

Using kibana 4.4.2 on CentOS 7

(Mark Walkom) #18

Please do.

(system) #19