Syslog+Fluentd+InfluxDB日志收集系统搭建

环境配置

节点配置类型操作系统
Sched2G 2CPU 50GB ens3=>192.168.200.11KVM虚拟机CentOS 7
Nova4G 2CPU 50GB ens3=>192.168.2000.12KVM虚拟机CentOS 7

Sched节点配置

配置InfluxDB软件源

# cat <<EOF | sudo tee /etc/yum.repos.d/influxdb.repo
[influxdb]
name = InfluxDB Repository - RHEL \$releasever
baseurl = https://repos.influxdata.com/rhel/\$releasever/\$basearch/stable
enabled = 1
gpgcheck = 1
gpgkey = https://repos.influxdata.com/influxdb.key
EOF

# yum makecache

安装InfluxDB

# yum install influxdb -y

### 设置开机启动
# systemctl start influxdb
# systemctl enable influxdb
# systemctl stop firewalld
# systemctl disable firewalld

### 查询InfluxDB默认配置
# influxd config
### 开启web访问,URL地址http://192.168.200.11:8083
# vim /etc/influxdb/influxdb.conf
[admin]
  enabled = true
# systemctl restart influxdb

### 如果不是使用标准的默认目录,需要手动修改目录权限
# chown -R influxdb:influxdb /mnt/influx
# chown -R influxdb:influxdb /mnt/db

### 创建test数据库
# influx
> CREATE DATABASE test
> use test

安装Fluentd

# yum install epel-release
# yum makecache
# curl -L https://toolbelt.treasuredata.com/sh/install-redhat-td-agent2.sh | sh

安装InfluxDB插件

# td-agent-gem install fluent-plugin-influxdb

配置Fluentd

# vim /etc/td-agent/td-agent.conf
<source>
  type syslog
  port 42185
  tag  system
</source>

<match system.*.*>
  type influxdb
  dbname test
  flush_interval 10s
  host 192.168.200.11
  port 8086
</match>
# systemctl restart td-agent

Nova节点配置

配置rsyslog

# wget http://rpms.adiscon.com/v8-stable/rsyslog.repo -O /etc/yum.repos.d/rsyslog.repo
# yum makecache
# yum install rsyslog
# vim /etc/rsyslog.conf
*.* @192.168.200.11:42185
# systemctl restart rsyslog

验证安装

### 在Nova节点执行
# logger -p "local3.notice" "fwd test"

### 在Sched节点执行
# influx
> USE test
> SHOW MEASUREMENTS
> SELECT * FROM "system.local3.notice"

参考文档

Aggregate and Analyze Syslog with InfluxDB
influxdb的简单使用

转载于:https://www.cnblogs.com/silvermagic/p/7666314.html

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值