Graylog Sidecar日志采集

Graylog Sidecar介绍

在这里插入图片描述
Graylog Sidecar 是 Graylog 日志管理平台的一个组件,用于管理和配置日志收集代理(log collectors)。它允许你集中管理和监控分布在不同服务器上的日志收集器,方便地将日志数据发送到 Graylog 服务器进行集中存储、分析和可视化。

Graylog Sidecar 可以用于集成各种不同类型的日志收集器,包括但不限于 Filebeat、Winlogbeat、NXLog、rsyslog 等。通过 Graylog Sidecar,你可以在 Graylog 界面上配置和管理这些收集器的设置,包括日志文件路径、过滤规则、发送目标等。这样一来,你无需登录到每个服务器上手动配置收集器,而是通过 Graylog 界面统一管理和监控所有的收集器。

Graylog Sidecar 的核心概念是"收集器配置"(Collector Configuration)。每个收集器配置对应一台服务器上的一个日志收集器实例。你可以为每个收集器配置指定具体的收集器类型、收集器标识、日志文件路径、过滤规则等信息。Graylog Sidecar 将这些配置应用到相应的收集器上,并负责启动、停止、重启和监控收集器的状态。

Graylog Sidecar 使用步骤

  1. 在 Graylog 界面上创建和配置收集器配置。
  2. 在需要收集日志的服务器上安装 Graylog Sidecar。
  3. 在服务器上运行 Graylog Sidecar 并与 Graylog 服务器建立连接。
  4. Graylog Sidecar 根据配置启动相应的日志收集器,并开始收集、过滤和发送日志数据到 Graylog 服务器。
  5. Graylog 服务器接收和处理日志数据,并提供搜索、过滤、分析和可视化功能。

Graylog Sidecar 安装

graylog sidecar 安装需要和graylog进行版本对应如下所示:
在这里插入图片描述

ubuntu安装

wget https://packages.graylog2.org/repo/packages/graylog-sidecar-repository_1-5_all.deb
sudo dpkg -i graylog-sidecar-repository_1-5_all.deb
sudo apt-get update && sudo apt-get install graylog-sidecar      
curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-8.8.1-x86_64.rpm
sudo rpm -vi filebeat-8.8.1-x86_64.rpm      

centos安装

sudo rpm -Uvh https://packages.graylog2.org/repo/packages/graylog-sidecar-repository-1-5.noarch.rpm
sudo yum install graylog-sidecar
sudo graylog-sidecar -service install
sudo systemctl enable graylog-sidecar
sudo systemctl start graylog-sidecar 
curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-8.8.1-x86_64.rpm
sudo rpm -vi filebeat-8.8.1-x86_64.rpm

Windows 安装

访问下载exe安装包进行安装
详情参考官网

graylog配置说明

选择input 配置Beats
在这里插入图片描述
点击new input 选择Global
在这里插入图片描述
注意 如果是docker配置的注意要将5044端口映射出去

选择sidecar
在这里插入图片描述
点击  Create or reuse a token for the graylog-sidecar user
在这里插入图片描述
填写token的名字创建token,复制生成的token在sidecae.yml需要配置

编辑 sidecae.yml

window 修改 C:\Program Files\Graylog\sidecar

# The URL to the Graylog server API.
#这里改成你自己的gralog的api
# Default: "http://127.0.0.1:9000/api/"
server_url: "http://127.0.0.1:9000/api"
# The API token to use to authenticate against the Graylog server API.
# Default: none 通过graylog生成token
server_api_token: "5k9j2506042ladcaa09vlgp7cok5q7la2ilpr5d7j2no82e7fkp"

# The node ID of the sidecar. This can be a path to a file or an ID string.
# If set to a file and the file doesn't exist, the sidecar will generate an
# unique ID and writes it to the configured path.
#
# Example file path: "file:C:\\Program Files\\Graylog\\sidecar\\node-id"
# Example ID string: "6033137e-d56b-47fc-9762-cd699c11a5a9"
#
# ATTENTION: Every sidecar instance needs a unique ID!
#
# Default: "file:C:\\Program Files\\Graylog\\sidecar\\node-id"
node_id: "file:C:\\Program Files\\Graylog\\sidecar\\node-id"

# The node name of the sidecar. If this is empty, the sidecar will use the
# hostname of the host it is running on.
# Default: "本机的地址"
node_name: "192.168.43.153"

# The update interval in secods. This configures how often the sidecar will
# contact the Graylog server for keep-alive and configuration update requests.
# Default: 10
update_interval: 10

# This configures if the sidecar should skip the verification of TLS connections.
# Default: false
tls_skip_verify: false

# A list of tags to assign to this sidecar. Collector configuration matching any of these tags will automatically be
# applied to the sidecar.
# Default: []
tags: []

windows重新启动Graylog Sidecar可以看到当前ip连接成功
在这里插入图片描述

配置filebate

点击 configuration创建Filebeat
在这里插入图片描述
填写name 根据服务器类型选择
在这里插入图片描述
在这里插入图片描述
配置log日志的的位置 修改paths为自己的log路劲
配置 graylog的input 修改hosts为自己的

关联

在这里插入图片描述
在这里插入图片描述
选择filebate 关联刚刚创建的日志收集器 点击svae保存
在这里插入图片描述
点击 start 启动日志推送

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

stayhungerstayflush

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值