Skip to content

Commit 341783d

Browse files
kenhysdaipom
andauthored
Update splunk alternative for fluent-package (#551)
Signed-off-by: Kentaro Hayashi <hayashi@clear-code.com> Co-authored-by: Daijiro Fukuda <fukuda@clear-code.com>
1 parent e528533 commit 341783d

File tree

1 file changed

+55
-33
lines changed

1 file changed

+55
-33
lines changed

how-to-guides/free-alternative-to-splunk-by-fluentd.md

Lines changed: 55 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Free Alternative To Splunk
22

3-
[Splunk](http://www.splunk.com/) is a great tool for searching logs, but its high cost makes it prohibitive for many teams. In this article, we present a free and open-source alternative to Splunk by combining three open source projects: Elasticsearch, Kibana, and Fluentd.
3+
[Splunk](https://www.splunk.com/) is a great tool for searching logs, but its high cost makes it prohibitive for many teams. In this article, we present a free and open-source alternative to Splunk by combining three open source projects: Elasticsearch, Kibana, and Fluentd.
44

55
![Kibana Visualization](../.gitbook/assets/kibana6-screenshot-visualize.png)
66

@@ -10,29 +10,39 @@ By combining these three tools \(Fluentd + Elasticsearch + Kibana\) we get a sca
1010

1111
![Fluentd + Elasticsearch + Kibana](../.gitbook/assets/fluentd-elasticsearch-kibana.png)
1212

13-
In this guide, we will go over the installation, setup, and basic use of this combined log search solution. This article was tested on Ubuntu 16.04 and CentOS 7.4. **If you're not familiar with Fluentd**, please learn more about Fluentd first.
13+
In this guide, we will go over the installation, setup, and basic use of this combined log search solution. This article was tested on Ubuntu 24.04. **If you're not familiar with Fluentd**, please learn more about Fluentd first.
1414

1515
## Prerequisites
1616

17+
* Java runtime (OpenJDK - JRE 21)
18+
* [Fluentd](https://www.fluentd.org/)
19+
* [Elasticsearch](https://www.elastic.co/elasticsearch)
20+
* [Kibana](https://www.elastic.co/kibana)
21+
* [Fluentd Elasticsearch Plugin](../output/elasticsearch.md)
22+
23+
You can install Fluentd via major packaging systems.
24+
25+
* [Installation](../installation/)
26+
1727
### Java for Elasticsearch
1828

19-
Please confirm that Java version 8 or higher is installed:
29+
Please confirm that Java version 21 or higher is installed:
2030

2131
```text
22-
$ java -version
23-
openjdk version "1.8.0_151"
24-
OpenJDK Runtime Environment (build 1.8.0_151-b12)
25-
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)
32+
$ java --version
33+
openjdk 21.0.5 2024-10-15
34+
OpenJDK Runtime Environment (build 21.0.5+11-Ubuntu-1ubuntu124.04)
35+
OpenJDK 64-Bit Server VM (build 21.0.5+11-Ubuntu-1ubuntu124.04, mixed mode, sharing)
2636
```
2737

28-
## Set Up Elasticsearch
38+
### Set Up Elasticsearch
2939

3040
To install Elasticsearch, please download and extract the Elasticsearch package as shown below:
3141

3242
```text
33-
$ curl -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.1.0.tar.gz
34-
$ tar -xf elasticsearch-6.1.0.tar.gz
35-
$ cd elasticsearch-6.1.0
43+
$ curl -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.17.1-linux-x86_64.tar.gz
44+
$ tar -xf elasticsearch-8.17.1-linux-x86_64.tar.gz
45+
$ cd elasticsearch-8.17.1
3646
```
3747

3848
Once the installation is complete, start Elasticsearch:
@@ -41,16 +51,20 @@ Once the installation is complete, start Elasticsearch:
4151
$ ./bin/elasticsearch
4252
```
4353

44-
Note: You can also install Elasticsearch \(and Kibana\) using RPM/DEB packages. For details, please refer to [the official instructions](https://www.elastic.co/downloads).
54+
{% hint style='info' %}
55+
* You can also install Elasticsearch \(and Kibana\) using RPM/DEB packages. For details, please refer to [the official instructions](https://www.elastic.co/downloads).
56+
* You can create enrollment token for kinaba. Use `./bin/elasticsearch-create-enrollment-token -s kibana`.
57+
* You can reset default password for `elastic`, Use `./bin/elasticsearch-reset-password -u elastic`.
58+
{% endhint %}
4559

46-
## Set Up Kibana
60+
### Set Up Kibana
4761

4862
To install Kibana, download it from the official website and extract it. Kibana is an HTML/CSS/JavaScript application \([download](https://www.elastic.co/downloads/kibana)\). Use the binary for 64-bit Linux systems.
4963

5064
```text
51-
$ curl -O https://artifacts.elastic.co/downloads/kibana/kibana-6.1.0-linux-x86_64.tar.gz
52-
$ tar -xf kibana-6.1.0-linux-x86_64.tar.gz
53-
$ cd kibana-6.1.0-linux-x86_64
65+
$ curl -O https://artifacts.elastic.co/downloads/kibana/kibana-8.17.1-linux-x86_64.tar.gz
66+
$ tar -xf kibana-8.17.1-linux-x86_64.tar.gz
67+
$ cd kibana-8.17.1-linux-x86_64
5468
```
5569

5670
Once the installation is complete, start Kibana i.e. `./bin/kibana`. You can modify its configuration file \(`config/kibana.yml`\).
@@ -61,19 +75,17 @@ $ ./bin/kibana
6175

6276
Access `http://localhost:5601` in your browser.
6377

64-
## Set Up Fluentd \(`td-agent`\)
78+
## Set Up Fluentd \(`fluent-package`\)
6579

66-
In this section, we'll install `td-agent`, the stable release of Fluentd. Please refer to the guides below for detailed instructions:
80+
You can install Fluentd via major packaging systems.
6781

6882
* [Installation](../installation/)
6983

70-
Next, we'll install the Elasticsearch plugin for Fluentd: fluent-plugin-elasticsearch. Then, install `fluent-plugin-elasticsearch` as follows:
84+
Next, we'll install the Elasticsearch plugin for Fluentd: fluent-plugin-elasticsearch. Then, install `fluent-plugin-elasticsearch`.
7185

72-
```text
73-
$ sudo /usr/sbin/td-agent-gem install fluent-plugin-elasticsearch --no-document
74-
```
86+
See [Plugin Management](..//installation/post-installation-guide#plugin-management) section how to install fluent-plugin-elasticsearch on your environment.
7587

76-
We'll configure td-agent \(Fluentd\) to interface properly with Elasticsearch. Please modify `/etc/td-agent/td-agent.conf` as shown below:
88+
We'll configure fluent-package \(Fluentd\) to interface properly with Elasticsearch. Please modify `/etc/fluent/fluentd.conf` as shown below:
7789

7890
```text
7991
# get logs from syslog
@@ -90,27 +102,34 @@ We'll configure td-agent \(Fluentd\) to interface properly with Elasticsearch. P
90102
91103
<match syslog.**>
92104
@type elasticsearch
105+
host localhost
106+
user elastic
107+
password (ELASTIC_USER_PASSWORD_HERE)
93108
logstash_format true
109+
scheme https
110+
ssl_verify false
111+
include_timestamp true
94112
<buffer>
95113
flush_interval 10s # for testing
96114
</buffer>
97115
</match>
98116
```
99117

118+
{% hint style='warning' %}
119+
In this article, it disables verification of TLS explicitly for elasticsearch because of demonstration. Do not disable on production.
120+
{% endhint %}
121+
100122
`fluent-plugin-elasticsearch` comes with a `logstash_format` option that allows Kibana to search through the stored event logs in Elasticsearch.
101123

102-
Once everything has been set up and configured, start `td-agent`:
124+
Once everything has been set up and configured, start `fluentd`:
103125

104126
```text
105-
# init
106-
$ sudo /etc/init.d/td-agent start
107-
# or systemd
108-
$ sudo systemctl start td-agent.service
127+
$ sudo systemctl start fluentd
109128
```
110129

111130
## Set Up `rsyslogd`
112131

113-
The final step is to forward the logs from your `rsyslogd` to `fluentd`. Please add the following line to `/etc/rsyslog.conf`, and restart `rsyslog`. This will forward the local syslogs to Fluentd, and Fluentd in turn will forward the logs to Elasticsearch.
132+
The final step is to forward the logs from your `rsyslogd` to `fluentd`. Please create the file with following line to `/etc/rsyslog.d/90-fluentd.conf`, and restart `rsyslog`. This will forward the local syslogs to Fluentd, and Fluentd in turn will forward the logs to Elasticsearch.
114133

115134
```text
116135
*.* @127.0.0.1:42185
@@ -119,9 +138,6 @@ The final step is to forward the logs from your `rsyslogd` to `fluentd`. Please
119138
Please restart the `rsyslog` service once the modification is complete:
120139

121140
```text
122-
# init
123-
$ sudo /etc/init.d/rsyslog restart
124-
# or systemd
125141
$ sudo systemctl restart rsyslog
126142
```
127143

@@ -147,7 +163,7 @@ To manually send logs to Elasticsearch, please use the `logger` command:
147163
$ logger -t test foobar
148164
```
149165

150-
When debugging your `td-agent` configuration, using [`filter_stdout`](../filter/stdout.md) will be useful. All the logs including errors can be found at `/etc/td-agent/td-agent.log`.
166+
When debugging your `fluentd` configuration, using [`filter_stdout`](../filter/stdout.md) will be useful. All the logs including errors can be found at `/etc/fluent/fluentd.log`.
151167

152168
```text
153169
<filter syslog.**>
@@ -156,7 +172,13 @@ When debugging your `td-agent` configuration, using [`filter_stdout`](../filter/
156172
157173
<match syslog.**>
158174
@type elasticsearch
175+
host localhost
176+
user elastic
177+
password (ELASTIC_USER_PASSWORD_HERE)
159178
logstash_format true
179+
scheme https
180+
ssl_verify false
181+
include_timestamp true
160182
<buffer>
161183
flush_interval 10s # for testing
162184
</buffer>

0 commit comments

Comments
 (0)