Log inSign up

Search all your logs in one place with Graylog

Install MongoDB 8.0 from its official repository, add the Graylog 7.2 repository package, then install graylog-datanode and graylog-server with the same password_secret in both configs. Keep the web interface on 127.0.0.1:9000, finish the preflight with the one time password from the server log, and create a Syslog TCP input that your servers forward to.

Topic: Monitoring and logs · Tested on: Ubuntu 24.04 and 22.04, Debian 12 and 13 · Updated 2026-12-03

What does Graylog need from the server?

Graylog has three parts on one host: MongoDB stores settings, the Data Node runs the search engine that holds your log messages, and Graylog Server receives, processes and displays them. All three use Java or large memory caches, so plan for at least 8 GB of RAM and 4 vCPUs for a small setup, plus fast disk for the indices. An NVMe plan such as A4-12 or I8-16 is a comfortable starting point; a 2 GB server will not run it.

MongoDB 8.0 requires a CPU with AVX. Check before you begin:

grep -m1 -o avx /proc/cpuinfo
free -h
df -h /

The first command must print avx. Commands below target Ubuntu 24.04 and Debian 12 or 13. Run updates first and set the correct time, because log timestamps matter here (see time sync).

How do I install MongoDB from the official repository?

Add the MongoDB signing key and the repository for your release, then install and hold the package so a routine upgrade does not jump major versions under Graylog:

sudo apt update
sudo apt install -y gnupg curl wget openssl
curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg --dearmor

# Ubuntu 24.04
echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list

# Debian 12 (use trixie instead of bookworm on Debian 13)
echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/debian bookworm/mongodb-org/8.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list

sudo apt update
sudo apt install -y mongodb-org
sudo apt-mark hold mongodb-org
sudo systemctl enable --now mongod
mongod --version

MongoDB listens on 127.0.0.1:27017 by default. Leave it that way: nothing outside the server needs to reach it.

How do I install and configure the Graylog Data Node?

Add the Graylog repository package, install the Data Node, and raise the memory map limit its search engine needs:

wget https://packages.graylog2.org/repo/packages/graylog-7.2-repository_latest.deb
sudo dpkg -i graylog-7.2-repository_latest.deb
sudo apt update
sudo apt install -y graylog-datanode

echo "vm.max_map_count=262144" | sudo tee /etc/sysctl.d/99-graylog-datanode.conf
sudo sysctl --system
cat /proc/sys/vm/max_map_count

Generate one shared secret and keep it in your password manager; both components must use the exact same value:

openssl rand -hex 32

Open /etc/graylog/datanode/datanode.conf and set:

password_secret = PASTE_THE_HEX_STRING
mongodb_uri = mongodb://localhost/graylog
opensearch_heap = 2g

The opensearch_heap line is not in the file by default; add it. Use roughly a quarter of RAM on a single box that also runs Graylog Server. Then start it:

sudo systemctl enable --now graylog-datanode
systemctl status graylog-datanode --no-pager

How do I set up Graylog Server itself?

Install the server package from the same repository:

sudo apt install -y graylog-server

Create the hash of the admin password you will use after setup. This reads the password without echo and prints its SHA-256:

read -rs PW; printf %s "$PW" | sha256sum | cut -d" " -f1; unset PW

Edit /etc/graylog/server/server.conf:

password_secret = PASTE_THE_SAME_HEX_STRING
root_password_sha2 = PASTE_THE_SHA256
http_bind_address = 127.0.0.1:9000
http_external_uri = https://logs.example.net/

Set the Java heap in /etc/default/graylog-server by changing the -Xms and -Xmx values in GRAYLOG_SERVER_JAVA_OPTS, for example both to 2g on a 12 GB plan, then start the service:

sudo systemctl enable --now graylog-server
sudo ss -tlnp | grep 9000

The listener must show 127.0.0.1:9000, not a public address.

How do I complete the first login safely?

On its first start Graylog runs a preflight setup and prints a one time username and password to its log. Read them:

sudo grep -i "initial configuration" /var/log/graylog-server/server.log

From your computer, tunnel to the loopback port and open the page locally:

ssh -N -L 9000:127.0.0.1:9000 deploy@198.51.100.24

Browse to http://127.0.0.1:9000, sign in with the preflight credentials and follow the steps: create the internal certificate authority, provision the Data Node and let it connect. After that, Graylog finishes booting and you sign in as admin with the password whose hash you stored. The preflight password stops working at that point, which is expected.

How do I publish the web interface over HTTPS?

For daily use from a browser, put Graylog behind a reverse proxy with a real certificate, keeping port 9000 closed. With Caddy, after pointing an A record for logs.example.net at the server (see DNS records):

logs.example.net {
    reverse_proxy 127.0.0.1:9000
}

Caddy obtains the certificate itself, as described in the Caddy HTTPS tutorial. Graylog has its own login, so access is already password protected; still create personal user accounts instead of sharing admin, and consider an IP allow list in the proxy for extra safety. Open only 80 and 443:

sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw status

The http_external_uri value you set earlier tells Graylog which public address the browser uses, so links and API calls work through the proxy.

How do I get logs into Graylog?

In the web interface open System, then Inputs, choose Syslog TCP and launch it on port 1514 (ports below 1024 need root, which Graylog does not have). Bind it to 0.0.0.0 only if other servers will send; for this host alone use 127.0.0.1.

Forward the local system logs with rsyslog by creating /etc/rsyslog.d/60-graylog.conf:

*.* action(type="omfwd" target="127.0.0.1" port="1514" protocol="tcp"
           template="RSYSLOG_SyslogProtocol23Format")
sudo apt install -y rsyslog
sudo systemctl restart rsyslog
logger -t graylog-test "first message"

Search for graylog-test in the Search page; the message appears within seconds. For remote senders, allow each address to port 1514 with sudo ufw allow from 203.0.113.10 to any port 1514 proto tcp, and use the forwarding setup from the rsyslog guide with a disk queue. Apps can also send structured GELF messages to a GELF input on port 12201.

How do I keep it healthy and up to date?

  • Retention: under System, Indices, set how many days or how much space the default index set keeps. This is the main control over disk use.
  • Disk alerts: watch free space with Monit or the Usage graphs tab; a full disk stops indexing.
  • Minor updates: sudo apt update && sudo apt upgrade installs new 7.2 releases. Restart graylog-datanode before graylog-server.
  • Major upgrades: install the next repository package (for example a later 7.x) only after reading its upgrade notes, and keep MongoDB on a version that release supports.
  • Troubleshooting: read /var/log/graylog-server/server.log and journalctl -u graylog-datanode -n 100. Heap errors mean the plan needs more RAM or a smaller heap split.

Back up /etc/graylog and a MongoDB dump with mongodump; the daily backups tutorial adds off server copies.

Plans that fit this guide

Base city prices. Every plan includes a dedicated IPv4 address, IPv6, full root and all 18 images.

All prices
PlanFits becauseSizeMonthlyOrder from
A4-12Graylog, Data Node and MongoDB on one box4 vCPU, 12 GB RAM, 260 GB NVMe$43.20/mo$43.20 for 1 month
I8-16more senders and longer retention8 vCPU, 16 GB RAM, 350 GB NVMe$57.60/mo$57.60 for 1 month
A8-16room for heavier search loads8 vCPU, 16 GB RAM, 350 GB NVMe$57.60/mo$57.60 for 1 month

Questions about Graylog log management

Can I run Graylog on a 4 GB plan?

It may start, but the search engine and the server compete for memory and indexing stalls. Start with 8 GB or more; a 12 GB or 16 GB NVMe plan leaves room for growth.

Do I still need OpenSearch separately?

Not with the Data Node. It bundles and manages the search engine, including its certificates, so you install one package instead of configuring a cluster by hand.

Which MongoDB version should I use?

This guide uses MongoDB 8.0. Check the compatibility table in the Graylog documentation before upgrading either component, and keep apt-mark hold on MongoDB until you plan the change.

Is the free edition enough?

Graylog Open covers inputs, search, streams, dashboards and alerts, which is plenty for a few servers. Paid editions add features that larger teams may want.

How do I send logs from Docker containers?

Start containers with the GELF log driver pointing at a GELF UDP input, for example --log-driver gelf --log-opt gelf-address=udp://127.0.0.1:12201.

Should I expose port 9000 directly?

No. Keep it on 127.0.0.1 and publish it through an HTTPS reverse proxy, or use an SSH tunnel for admin work.