|
| 1 | +# Send Syslog Data to Graylog |
| 2 | + |
| 3 | +This article explains how to set up Fluentd with [Graylog](https://www.graylog.org). Graylog is a popular log management server powered by Elasticsearch and MongoDB. You can combine Fluentd and Graylog to create a scalable log analytics pipeline. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +* Basic Understanding of Fluentd |
| 8 | +* Linux Server (Ubuntu 24.04 LTS is not supported yet. Use 20.04 or 22.04) |
| 9 | +* [Fluentd](https://www.fluentd.org/) |
| 10 | +* [MongoDB Community Server](https://www.mongodb.com/try/download/community), Use 7.0. |
| 11 | +* [Graylog](https://graylog.org/), Use 6.1. |
| 12 | + |
| 13 | +<!-- Ubuntu 24.04LTS is not officially supported for Graylog2 6.0--> |
| 14 | + |
| 15 | +You can install Fluentd via major packaging systems. |
| 16 | + |
| 17 | +* [Installation](../installation/) |
| 18 | + |
| 19 | +You can install MongoDB via major packaging systems. |
| 20 | + |
| 21 | +* [MongoDB Community Server](https://www.mongodb.com/try/download/community) |
| 22 | + |
| 23 | +{% hint style='warning' %} |
| 24 | +Use MongoDB 7.x because Graylog 6.1 does not support MongoDB 8.x. |
| 25 | +{% endhint %} |
| 26 | + |
| 27 | +You can install Graylog Data Node and Server on Ubuntu. |
| 28 | + |
| 29 | +* [Ubuntu Installation](https://go2docs.graylog.org/current/downloading_and_installing_graylog/ubuntu_installation.htm) |
| 30 | + |
| 31 | +### Prepare Graylog for Fluentd |
| 32 | + |
| 33 | +Go to [http://localhost:9000](http://localhost:9000) and log into the web interface. |
| 34 | + |
| 35 | +To log in, use `admin` as the username and `YOUR_PASSWORD` as the password \(the one you have set up for `root_password_sha2`\). |
| 36 | + |
| 37 | +Once logged in, click on `System` in the top nav. Next, click on `Inputs` from the left navigation bar. \(Or, simply go to [http://localhost:9000/system/inputs](http://localhost:9000/system/inputs). |
| 38 | + |
| 39 | +Then, from the dropdown, choose `GELF UDP` and click on `Launch new input`, which should pop up a modal dialogue, Select the `Node` and fill the `Title`. Then, click `Save`. |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | +Now, Graylog is ready to accept messages from Fluentd over UDP. It is time to configure Fluentd. |
| 44 | + |
| 45 | +{% hint style='info' %} |
| 46 | +There might be a case that modal dialogue will not shown when clicking `Launch new input`. Check your browser configuration. |
| 47 | +{% endhint %} |
| 48 | + |
| 49 | +### Fluentd |
| 50 | + |
| 51 | +You can install Fluentd via major packaging systems. |
| 52 | + |
| 53 | +* [Installation](../installation/) |
| 54 | + |
| 55 | +#### Install MongoDB Plugin |
| 56 | + |
| 57 | +If `out_gelf` (fluent-plugin-gelf-hs) is not installed yet, please install it manually. |
| 58 | + |
| 59 | +See [Plugin Management](..//installation/post-installation-guide#plugin-management) section how to install fluent-plugin-gelf-hs on your environment. |
| 60 | + |
| 61 | +Then, configure `/etc/fluent/fluentd.conf` as follows: |
| 62 | + |
| 63 | +```text |
| 64 | +<source> |
| 65 | + @type syslog |
| 66 | + tag graylog |
| 67 | +</source> |
| 68 | +
|
| 69 | +<match graylog.**> |
| 70 | + @type gelf |
| 71 | + host 127.0.0.1 |
| 72 | + port 12201 |
| 73 | + <buffer> |
| 74 | + flush_interval 5s |
| 75 | + </buffer> |
| 76 | +</match> |
| 77 | +``` |
| 78 | + |
| 79 | +Create `/etc/rsyslog.d/90-fluentd.conf` and add the following line to the file: |
| 80 | + |
| 81 | +```text |
| 82 | +*.* @127.0.0.1:5140 |
| 83 | +``` |
| 84 | + |
| 85 | +Finally, restart `rsyslog` and Fluentd with the following commands: |
| 86 | + |
| 87 | +```text |
| 88 | +$ sudo systemctl restart rsyslog |
| 89 | +$ sudo systemctl restart fluentd |
| 90 | +``` |
| 91 | + |
| 92 | +## Visualize the Data Stream |
| 93 | + |
| 94 | +When you log back into Graylog, you should be seeing a graph like this \(wait for events to flow in\): |
| 95 | + |
| 96 | + |
| 97 | + |
| 98 | +If this article is incorrect or outdated, or omits critical information, please [let us know](https://github.com/fluent/fluentd-docs-gitbook/issues?state=open). [Fluentd](http://www.fluentd.org/) is an open-source project under [Cloud Native Computing Foundation \(CNCF\)](https://cncf.io/). All components are available under the Apache 2 License. |
| 99 | + |
0 commit comments