Greylog Docker Setup Fortigate logging
Graylog Docker Compose + FortiGate Syslog
This setup runs:
- Graylog 7.1
- Graylog Data Node
- MongoDB 7
- Syslog TCP/UDP on port
5140 - Graylog web interface on port
9000
1. Recommended VM
For a home/lab environment:
| |
If you intend to retain large amounts of firewall traffic logs, increase the storage accordingly.
2. Install Docker
If Docker and Docker Compose are already installed, skip this section.
| |
Optional: allow your user to run Docker without sudo:
| |
Log out and back in afterwards.
Check:
| |
3. Configure the Host
Graylog Data Node requires an increased virtual memory map limit.
| |
Confirm:
| |
You should see:
| |
4. Create the Graylog Directory
| |
5. Generate the Graylog Password Secret
Generate a random secret:
| |
Copy the output somewhere temporarily.
This is not your login password.
6. Generate the Admin Password Hash
Choose the password you want to use for the Graylog admin account.
Run:
| |
For example:
| |
Copy only the hash:
| |
Do not put the plain-text password in the .env file.
7. Create the .env File
| |
Add:
GRAYLOG_PASSWORD_SECRET=PASTE_YOUR_96_CHARACTER_SECRET_HERE
GRAYLOG_ROOT_PASSWORD_SHA2=PASTE_YOUR_PASSWORD_HASH_HERE
GRAYLOG_HTTP_EXTERNAL_URI=http://10.10.10.50:9000/Replace:
| |
with the IP address of your Graylog Ubuntu VM.
Save with:
| |
Protect the file:
| |
8. Create docker-compose.yml
| |
Paste:
| |
9. Start Graylog
From:
| |
Run:
| |
Check the containers:
| |
You should eventually have:
| |
all running.
10. Watch the Logs
| |
Or Graylog only:
| |
On the first startup, Graylog generates a temporary preflight password.
Find it with:
| |
You should see something similar to:
| |
Use this temporary password for the first configuration only.
11. Open Graylog
Browse to:
| |
Replace the IP with your Graylog VM IP.
For the initial setup:
| |
Complete the Data Node setup wizard.
After the initial provisioning is finished, log in using:
| |
12. Create the FortiGate Syslog Input
In Graylog go to:
| |
Select:
| |
and click:
| |
Configure:
| |
Then:
| |
You should now see the input as:
| |
TCP Alternative
You can alternatively create:
| |
on:
| |
TCP is preferable if you want reliable delivery.
For initial testing, UDP is slightly simpler.
13. Configure FortiGate
SSH to the FortiGate or use its CLI.
UDP
| |
Replace:
| |
with the Graylog server IP.
Check the configuration:
| |
14. TCP / Reliable Syslog
If you created a Syslog TCP input in Graylog instead:
| |
I would eventually use TCP/reliable rather than UDP once everything is working.
15. Enable FortiGate Traffic Logging
The FortiGate must actually generate logs for firewall policies.
In the GUI:
| |
Set:
| |
Or CLI:
| |
Replace 1 with the required firewall policy ID.
You don’t necessarily need all enabled on every policy. High-traffic rules can generate a significant amount of log data.
16. Check Whether Graylog Is Receiving Logs
In Graylog:
| |
Set the time range to:
| |
You should begin seeing messages containing FortiGate fields such as:
| |
17. Check Syslog at the Ubuntu Host
If nothing appears in Graylog, check whether packets are reaching the server.
For UDP:
| |
For TCP:
| |
You should see traffic coming from the FortiGate IP.
Check Docker is listening:
| |
18. Useful Docker Commands
Container status
| |
View logs
| |
Graylog logs only
| |
Restart everything
| |
Restart Graylog
| |
Stop
| |
Start
| |
Update images
| |
19. Data Persistence
The following Docker volumes contain the persistent data:
| |
Check them with:
| |
Do not run:
| |
unless you deliberately want to delete all Graylog data.
20. Recommended Layout
| |
You can later send logs from additional devices into exactly the same server:
| |
For different device types, create separate Graylog inputs or streams so the logs can easily be filtered and searched.