You can support us by downloading this article as PDF from the Link below. Download the guide as PDF

In this guide, we will take you through the steps to Install Graylog on CentOS 8 / RHEL 8 with Elasticsearch 6.x and MongoDB 4.x. Graylog is an open-source log management system that allows System Administrators/Developers to aggregate up to terabytes of log data, from multiple log sources. It is highly scalable to fit any Infrastructure.

Graylog comes with an intuitive UI, fast and powerful search feature, alerting and reporting. It lets you group systems into streams for ease of log searching and proper management. Graylog UI is simple and intuitive with complete user management and support for LDAP.

Similar articles: How To Forward Logs to Grafana Loki using Promtail

Install Graylog 3.x on CentOS 8 / RHEL 8 Linux

Graylog requires Java, Elasticsearch, and MongoDB. Elasticsearch is responsible for logs storage. We will begin with the installation of the dependencies then Graylog.

Note: This is a single server installation of Graylog on CentOS 8 / RHEL 8. For multi-cluster setup, consult official Graylog documentation.

Step 1: Configure SELinux

If you’re using SELinux on your system, set the following settings:

sudo yum -y install curl vim policycoreutils python3-policycoreutils
sudo setsebool -P httpd_can_network_connect 1
sudo semanage port -a -t http_port_t -p tcp 9000
sudo semanage port -a -t http_port_t -p tcp 9200
sudo semanage port -a -t mongod_port_t -p tcp 27017

Step 2: Install Java on RHEL / CentOS 8

As Elasticsearch depends on Java 8, you need it installed on your system prior to installing Elasticsearch RHEL 8 / CentOS 8.

sudo yum install java-1.8.0-openjdk java-1.8.0-openjdk-devel

Step 3: Install Elasticsearch 6 on RHEL 8 / CentOS 8

Add Elasticsearch repository:

cat <<EOF | sudo tee /etc/yum.repos.d/elasticsearch.repo
name=Elasticsearch repository for 6.x packages

Then install Elasticsearch:

sudo yum clean all
sudo yum makecache
sudo yum -y install elasticsearch-oss

Configure Elasticsearch for Graylog

You need to modify the Elasticsearch configuration file and set the cluster name to graylog, Additionally, you need to uncomment (remove the # as first character) the line, and add action.auto_create_index: false to the configuration file:

The file to edit is /etc/elasticsearch/elasticsearch.yml.

$ sudo vi /etc/elasticsearch/elasticsearch.yml graylog
action.auto_create_index: false

Start and enable elasticsearch service:

sudo systemctl daemon-reload
sudo systemctl enable --now elasticsearch

Confirm service status:

$ systemctl status elasticsearch
● elasticsearch.service - Elasticsearch
   Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2019-09-13 03:53:34 EDT; 9s ago
 Main PID: 16862 (java)
    Tasks: 40 (limit: 24024)
   Memory: 1.1G
   CGroup: /system.slice/elasticsearch.service
           └─16862 /bin/java -Xms1g -Xmx1g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -Des.n>

Sep 13 03:53:34 rhel8.novalocal systemd[1]: Stopped Elasticsearch.
Sep 13 03:53:34 rhel8.novalocal systemd[1]: Started Elasticsearch.

The default Elasticsearch file locations are:

File system path
JVM settings/etc/default/elasticsearch
Data files/var/lib/elasticsearch/data
Log files/var/log/elasticsearch/

Learning course:

Step 4: Install MongoDB on RHEL 8 / CentOS 8

MongoDB is used for storing Graylog related configurations. Install it on CentOS 8 / RHEL 8 using the steps shared in the article below.

How to Install MongoDB 4 on RHEL 8 / CentOS 8

Enable and start mongod service after the installation.

sudo systemctl enable --now mongod

MongoDB paths:

File system path
Data files/var/lib/mongodb/
Log files/var/log/mongodb/

Status of the service should be running.

$ systemctl status mongod
● mongod.service - MongoDB Database Server
   Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2019-09-13 03:57:04 EDT; 6s ago
  Process: 17397 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=0/SUCCESS)
  Process: 17395 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS)
  Process: 17393 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS)
  Process: 17391 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS)
 Main PID: 17399 (mongod)
   Memory: 44.7M
   CGroup: /system.slice/mongod.service
           └─17399 /usr/bin/mongod -f /etc/mongod.conf

Sep 13 03:57:03 rhel8.novalocal systemd[1]: Starting MongoDB Database Server...
Sep 13 03:57:03 rhel8.novalocal mongod[17397]: 2019-09-13T03:57:03.538-0400 I STORAGE  [main] Max cache overflow file size custom option: 0
Sep 13 03:57:03 rhel8.novalocal mongod[17397]: about to fork child process, waiting until server is ready for connections.
Sep 13 03:57:03 rhel8.novalocal mongod[17397]: forked process: 17399
Sep 13 03:57:04 rhel8.novalocal mongod[17397]: child process started successfully, parent exiting
Sep 13 03:57:04 rhel8.novalocal systemd[1]: Started MongoDB Database Server.

Step 5: Install Graylog 3 on RHEL 8 / CentOS 8

Now install the Graylog repository configuration:

sudo rpm -Uvh

Graylog rpm packages are available on added repository.

sudo yum install graylog-server

I got version 3.1.2 from the installation.

$ rpm -qi graylog-server
 Name        : graylog-server
 Version     : 3.1.2
 Release     : 1
 Architecture: noarch
 Install Date: Fri 13 Sep 2019 03:58:28 AM EDT
 Group       : optional
 Size        : 131672482
 License     : GPLv3
 Signature   : RSA/SHA1, Thu 12 Sep 2019 11:14:37 AM EDT, Key ID d44c1d8db1606f22
 Source RPM  : graylog-server-3.1.2-1.src.rpm
 Build Date  : Thu 12 Sep 2019 11:14:29 AM EDT
 Build Host  : c3b660169564
 Relocations : / 
 Packager    : Graylog, Inc. [email protected]
 Vendor      : graylog
 URL         :
 Summary     : Graylog server
 Description :
 Graylog server

You need to set add password_secret and root_password_sha2 variables under /etc/graylog/server/server.conf. These settings are mandatory and without them, Graylog will not start!

Use the following command to create your root_password_sha2:

echo -n "Enter Password: " && head -1 </dev/stdin | tr -d '\n' | sha256sum | cut -d" " -f1

Set generated value in root_password_sha2

$ sudo vi /etc/graylog/server/server.conf

root_username = admin
root_password_sha2 = <Sha2Passowrd>

Generate password_secret.

$ sudo yum -y install pwgen
$ pwgen -N 1 -s 96

$ sudo vi /etc/graylog/server/server.conf
password_secret = ny5eSSuHe03DWW7hGOGMPaVOlbBeZX48OqvTIO7J56rBwh0r99wB1bQwecjyID9S5XrCkzVcPBG0jLPcWiit1Vz1nPse6yBq

To be able to connect to Graylog you should set http_bind_address to the public host name or a public IP address of the machine you can connect to.

http_bind_address =

The last step is to enable Graylog during the operating system’s startup:

sudo systemctl daemon-reload
sudo systemctl enable --now graylog-server.service

Access Graylog dashboard on http://serverip_or_hostname:9000/

graylog access ui

Login with username admin and root password set inside server.conf.

We installed Graylog 3.x with Elasticsearch 6.x on CentOS 8 / RHEL 8. Read next article on Configure Graylog Nginx reverse proxy with Letsencrypt SSL.

Then learn how to ingest messages into your Graylog and extract the messages with extractors or use the Pipelines to work with the messages.

Other interesting guides:

Install and Configure NFS Server on CentOS 8 / RHEL 8

How To Install Visual Studio Code On CentOS 8 / RHEL 8

How to Install Jenkins on CentOS 8 / RHEL 8

You can support us by downloading this article as PDF from the Link below. Download the guide as PDF


Please enter your comment!
Please enter your name here