monkey开源工具Linux,【Linux】开源数据收集工具:Fluentd

[root@wallet01 ~]# tar zxvf ruby-2.7.2.tar.gz

[root@wallet01 ~]# cd ruby-2.7.2

[root@wallet01 ruby-2.7.2]# ./configure

[root@wallet01 ruby-2.7.2]# make

[root@wallet01 ruby-2.7.2]# make install

[root@wallet01 ~]# ruby -v

ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]

[root@wallet01 ~]# gem install bundler

Fetching bundler-2.2.1.gem

Successfully installed bundler-2.2.1

Parsing documentation for bundler-2.2.1

Installing ri documentation for bundler-2.2.1

Done installing documentation for bundler after 2 seconds

1 gem installed

[root@wallet01 ~]# git clone https://github.com/fluent/fluentd.git

Cloning into 'fluentd'...

remote: Enumerating objects: 36, done.

remote: Counting objects: 100% (36/36), done.

remote: Compressing objects: 100% (17/17), done.

remote: Total 36828 (delta 15), reused 27 (delta 15), pack-reused 36792

Receiving objects: 100% (36828/36828), 17.57 MiB | 4.37 MiB/s, done.

Resolving deltas: 100% (24423/24423), done.

[root@wallet01 ~]# cd fluentd

[root@wallet01 fluentd]# git checkout v1.11.5

[root@wallet01 fluentd]# bundle install

[root@wallet01 fluentd]# bundle exec rake build

test_file_util.rb for non-root user env. Disable this test on root environment

fluentd 1.11.5 built to pkg/fluentd-1.11.5.gem.

[root@wallet01 fluentd]# gem install pkg/fluentd-1.11.5.gem

Successfully installed fluentd-1.11.5

Parsing documentation for fluentd-1.11.5

Installing ri documentation for fluentd-1.11.5

Done installing documentation for fluentd after 2 seconds

1 gem installed

[root@wallet01 ~]# fluent-gem install fluent-plugin-mongo

Fetching fluent-plugin-mongo-1.5.0.gem

Fetching bson-4.11.1.gem

Fetching fluentd-1.11.5.gem

Fetching mongo-2.6.4.gem

Successfully installed fluentd-1.11.5

Building native extensions. This could take a while...

Successfully installed bson-4.11.1

Successfully installed mongo-2.6.4

Successfully installed fluent-plugin-mongo-1.5.0

Parsing documentation for fluentd-1.11.5

Installing ri documentation for fluentd-1.11.5

Parsing documentation for bson-4.11.1

Installing ri documentation for bson-4.11.1

Parsing documentation for mongo-2.6.4

Installing ri documentation for mongo-2.6.4

Parsing documentation for fluent-plugin-mongo-1.5.0

Installing ri documentation for fluent-plugin-mongo-1.5.0

Done installing documentation for fluentd, bson, mongo, fluent-plugin-mongo after 7 seconds

4 gems installed

[root@wallet01 ~]# fluentd -s

Installed /etc/fluent/fluent.conf.

[root@wallet01 ~]# vim /etc/fluent/fluent.conf

@type tail

path /var/log/httpd/access_log

pos_file /var/log/td-agent/apache2.access_log.pos

@type apache2

tag mongo.apache.access

@type mongo

host 192.168.40.201

port 27017

database nagios

collection access

capped

capped_size 1024m

user nagios

password nagios@2020

time_key time

flush_interval 10s

[root@wallet01 ~]# mongo -u "root" -p "abcd@1234" --authenticationDatabase "admin"

MongoDB shell version v4.0.21

connecting to: mongodb://127.0.0.1:27017/?authSource=admin&gssapiServiceName=mongodb

Implicit session: session { "id" : UUID("0ee4fdd7-982a-4318-82da-db8254101dd5") }

MongoDB server version: 4.0.21

> show dbs

admin   0.000GB

config  0.000GB

local   0.000GB

> use nagios

switched to db nagios

> db.createUser({ user: "nagios",pwd: "nagios@2020",  roles: [ { role: "readWrite", db: "nagios" } ] })

Successfully added user: {

"user" : "nagios",

"roles" : [

{

"role" : "readWrite",

"db" : "nagios"

}

]

}

> db.auth("nagios","nagios@2020")

1

[root@wallet01 ~]# fluentd -d /var/run/fluentd.pid -o /var/log/fluentd.log

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值