graylog之collector-sidecar安装详解及实例配置
准备环境
yum install -y https://github.com/Graylog2/collector-sidecar/releases/download/0.1.7/collector-sidecar-0.1.7-1.x86_64.rpm
graylog-collector-sidecar -service install
mkdir -p /data/graylog/collector-sidecar/{logs,cache}
修改配置文件
server_url: http://192.168.3.24:9000/api/ //ip是graylog-server的
update_interval: 10
tls_skip_verify: false
send_status: true
list_log_files:
- /var/log/nginx/----跟目录 //目标日志的目录文件,确保目录存在
node_id: 192.168.3.25 //自行定
collector_id: file:/etc/graylog/collector-sidecar/collector-id
log_path: /data/graylog/collector-sidecar/logs //sidecar的
cache_path: /data/graylog/collector-sidecar/cache //sidecar的
log_rotation_time: 86400
log_max_age: 604800
tags:
- nginx_access //自行定义的标签,待会儿graylog的web操作时tags保持一致
backends:
- name: nxlog
enabled: false
binary_path: /usr/bin/nxlog
configuration_path: /etc/graylog/collector-sidecar/generated/nxlog.conf
- name: filebeat
enabled: true
binary_path: /usr/bin/filebeat
configuration_path: /etc/graylog/collector-sidecar/generated/filebeat.yml
配置完毕后,打开graylog的后台,如果配置正确,打开web界面会自动识别主机
此处简单栗子
切换到web界面
1.点击manage configurations
2.点击create configuration,name自定义
3.点击ceate output
4.hosts::填的是graylog-server得地址
5.配置input
forward to选项选择out[ut的
path to logfile::配置路径
6.参数参考
7.设置tags:和配置文件里的tags要保持一致
8.返回collector,看status变为renning,说明配置成功
9.点击inputs 选择beats --->launch new input
10.点击search出现如下图