EFK安装实记

EFK安装实记

以下内容是对flunt的一个简单实现,对fluent的具体配置还有很多的配置项,elasticsearch和kibana的安装本文中没有写明如有需要请留言

1 安装ruby

[root@localhost opt]# wget https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.5.tar.gz

[root@localhost opt]# tar zxf ruby-2.6.5.tar.gz

[root@localhost opt]# cd ruby-2.6.5/

[root@localhost ruby-2.6.5]# ./configure --prefix=/opt/ruby

[root@localhost ruby-2.6.5]# make

[root@localhost ruby-2.6.5]# make install

[root@localhost ruby-2.6.5]# ruby --version

Ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]

2 使用ruby安装fluent

[fluent@localhost fluentd]$ gem install fluentd

3 使用ruby安装fluent-plugin-elasticsearch

[fluent@localhost fluentd]$ gem install fluent-plugin-elasticsearch

4 初始化fluent

[fluent@localhost fluentd]$ fluentd --setup ./fluent(在当前目录下生成默认配置文件,该文件不必必须放在某个位置,启动时指定即可)

5 配置文件

[fluent@localhost ~]$ cat fluent/fluent.conf

type tail

path /var/log/message

pos_file /home/fluent/pos_log

tag message

@type syslog

type elasticsearch

host 192.168.135.174

port 9200

flush_interval 10s

[fluent@localhost fluentd]$ fluentd -c .fluent/fluent.conf -vv &

7 kibana 查询