Graylog is an open-source log management system that collects, indexes, and analyzes log data from various sources, providing real-time monitoring and alerting. Elasticsearch is a distributed search and analytics engine that efficiently indexes and queries large volumes of structured and unstructured data. Graylog often uses Elasticsearch as its storage and indexing backend for fast log searching and analysis. We will be installing the Graylog & Elastic Search on the Ubuntu 24.04LTS
Installing MongoDB Database (Community Edition)
Mongodb is the database system service which can be integrated by the graylog and which can be installed from the below given URL
Add the Elasticsearch repository to your sources list:
echo "deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/8.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-8.x.list
Updating the packages & installing Elastic search
sudo apt update
sudo apt install elasticsearch
Now the elastic search is installed and now we will configure the elastic search to enable the nodes & clusters to integrate with the graylog server
The configuration file of elasticsearch is located at /etc/elasticsearch/elasticsearch.yml we will add the following lines at the end of config file to enable the cluster :
sudo nano /etc/elasticsearch/elasticsearch.yml
## END OF THE CONFIG FILE
---------------------------------------
## CLUSTER CONFIG
cluster.name: graylog
action.auto_create_index: false
We will also set the value of parameter xpack.security.enabled: false to disable security pack feature as it might not give outputs as expected.
sudo nano /etc/elasticsearch/elasticsearch.yml
# Enable security features
xpack.security.enabled: false
Now we will restart the service of elastic search
sudo systemctl restart elasticsearch
Now we will be creating the new password for the user elastic so that we can manage it using the default credentials.
cd /usr/share/elasticsearch && sudo ./bin/elasticsearch-reset-password -u elastic
This will ask the option to display the password as plain text in the console then press y and note the password displayed at the terminal. Now we will check wheather our elastic node is working perfect or not :
Once installed we will start configuring graylog server and integrate with the elastic search datanode which was deployed above.
To run Graylog Data Node, the value of the "vm.max_map_count" sysctl setting needs to be at least 262144 or more. Run the following commands to set and persist the value.
sudo sysctl -w vm.max_map_count=262144
If the value is not the same we can do this by this command :
echo "vm.max_map_count = 262144" | sudo tee /etc/sysctl.d/99-graylog-datanode.conf
Configuring Graylog-server
The config file is located on /etc/graylog/server/server.conf , Firstly we will generate the 96 characters long random key and the encrypted password string to feed as input in the config file and then edit certian parameters to run the graylog server.
Generate a secret key for password hashing:
pwgen -N 1 -s 96
Generate an admin password hash:
echo -n 'YourPassword' | sha256sum
We will enter this vaules in the config files where the parameters are password_secret & root_password_sha2