news 2026/6/17 11:12:30

ELK通过winlogbeat收集windows系统日志并转发给logstash配置文件

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
ELK通过winlogbeat收集windows系统日志并转发给logstash配置文件

1、windows主机上winlogbeat配置

# ======================== Winlogbeat inputs ========================= winlogbeat.event_logs: # 1. 应用程序日志 - name: Application ignore_older: 72h # 2. 系统日志 - name: System ignore_older: 72h # 3. 安全日志 - name: Security ignore_older: 72h # 【重要建议】安全日志量极大,建议只采集关键事件ID,否则容易撑爆存储 # event_id: 4624, 4625, 4634, 4647, 4672, 4688, 4689, 4720, 4726 # ======================== Processors ========================= processors: - add_host_metadata: ~ - add_cloud_metadata: ~ # ======================== Outputs ========================= # 禁用 Elasticsearch 输出 # output.elasticsearch: # hosts: ["localhost:9200"] # 启用 Logstash 输出 output.logstash: hosts: ["10.10.xxx.xx:5044"] # 使用你之前提供的 Logstash 地址 compression_level: 3 loadbalance: true bulk_max_size: 2048 # ======================== Logging ========================= logging.level: info logging.to_files: true logging.files: path: C:\ProgramData\winlogbeat\logs name: winlogbeat.log keepfiles: 7

2、logstash配置文件

放入新建的pipeline目录里 [root@elk-lo-node03 pipeline]# cat windows-winlogbeat-log.conf input { beats { port => 5045 #目录下多个conf文件的话,端口要修改,不要冲突 tags => ["windows-input"] } } output { elasticsearch { hosts => ["https://10.10.xxx.xx:9200"] index => "logs-app-windows-%{+yyyy.MM.dd}" user => "elastic" password => "JcJv*xxxxxxxxxxxx" ssl_certificate_verification => false } stdout { codec => rubydebug } }

3、pipeline目录下新增conf文件后,要同步修改pipelines.yml

[root@elk-lo-node03 config]# pwd /opt/logstash/config [root@elk-lo-node03 config]# ll total 48 -rw-r--r-- 1 root root 2924 Apr 1 17:49 jvm.options -rw-r--r-- 1 root root 8680 Apr 1 17:49 log4j2.properties -rw-r--r-- 1 root root 502 Jun 4 14:37 logstash.conf -rw-r--r-- 1 root root 342 Apr 1 17:49 logstash-sample.conf -rw-r--r-- 1 root root 15745 Apr 1 17:49 logstash.yml drwxr-xr-x 2 root root 98 Jun 16 15:12 pipeline -rw-r--r-- 1 root root 794 Jun 16 15:14 pipelines.yml -rw-r--r-- 1 root root 1696 Apr 1 17:49 startup.options [root@elk-lo-node03 config]# ll pipeline total 12 -rw-r--r-- 1 root root 750 Jun 4 16:01 beats-elk-log.conf -rw-r--r-- 1 root root 359 Jun 16 15:03 network-device-log.conf -rw-r--r-- 1 root root 360 Jun 16 09:53 windows-winlogbeat-log.conf [root@elk-lo-node03 config]# cat pipelines.yml - pipeline.id: beats-elk-log #接收filebeat日志 path.config: "config/pipeline/beats-elk-log.conf" pipeline.workers: 2 pipeline.batch.size: 125 pipeline.batch.delay: 50 queue.type: persisted queue.max_bytes: 1gb queue.checkpoint.acks: 1024 queue.drain: false - pipeline.id: windows-winlogbeat-log #接收winlogbeat日志 path.config: "config/pipeline/windows-winlogbeat-log.conf" pipeline.workers: 2 pipeline.batch.size: 125 pipeline.batch.delay: 50 queue.type: persisted queue.max_bytes: 1gb queue.checkpoint.acks: 1024 queue.drain: false - pipeline.id: network-device-log #接收防火墙等网络设备日志 path.config: "config/pipeline/network-device-log.conf pipeline.workers: 2 pipeline.batch.size: 125 pipeline.batch.delay: 50 queue.type: persisted queue.max_bytes: 1gb queue.checkpoint.acks: 1024 queue.drain: false
版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/6/17 11:10:10

G-Helper完整教程:10分钟掌握华硕笔记本性能优化终极方案

G-Helper完整教程:10分钟掌握华硕笔记本性能优化终极方案 【免费下载链接】g-helper Lightweight Armoury Crate alternative for Asus laptops with nearly the same functionality. Works with ROG Zephyrus, Flow, TUF, Strix, Scar, ProArt, Vivobook, Zenbook,…

作者头像 李华
网站建设 2026/6/17 11:07:42

3步解锁AEUX:从Figma设计到After Effects动画的无缝转换秘诀

3步解锁AEUX:从Figma设计到After Effects动画的无缝转换秘诀 【免费下载链接】AEUX Editable After Effects layers from Sketch artboards 项目地址: https://gitcode.com/gh_mirrors/ae/AEUX 你是否曾经为Figma中精美设计的UI界面无法快速转换为After Effe…

作者头像 李华
网站建设 2026/6/17 11:01:04

MedLab-Z605大小鼠抓力测定仪

电子压痛仪具有压力准确,操作方便,数据打印,微机联接功能,附带压痛鸣叫音频放大电路和大\小鼠固定筒,是 科研教学非常实用的仪器之一,在实际使用中得到专家教授们的好评。 1、加压范围:0~2000克…

作者头像 李华
网站建设 2026/6/17 11:00:23

3步掌握BetterNCM插件管理器:从零构建Rust跨平台安装工具

3步掌握BetterNCM插件管理器:从零构建Rust跨平台安装工具 【免费下载链接】BetterNCM-Installer 一键安装 Better 系软件 项目地址: https://gitcode.com/gh_mirrors/be/BetterNCM-Installer 你是否曾为网易云音乐插件安装的繁琐流程而烦恼?Bette…

作者头像 李华
网站建设 2026/6/17 10:50:11

暗黑破坏神2现代化终极指南:D2DX宽屏补丁与高帧率优化方案

暗黑破坏神2现代化终极指南:D2DX宽屏补丁与高帧率优化方案 【免费下载链接】d2dx D2DX is a complete solution to make Diablo II run well on modern PCs, with high fps and better resolutions. 项目地址: https://gitcode.com/gh_mirrors/d2/d2dx 还在为…

作者头像 李华
网站建设 2026/6/17 10:49:21

3分钟学会Rescuezilla:让系统备份像拍照一样简单

3分钟学会Rescuezilla:让系统备份像拍照一样简单 【免费下载链接】rescuezilla The Swiss Army Knife of System Recovery 项目地址: https://gitcode.com/gh_mirrors/re/rescuezilla 还在为系统崩溃而手忙脚乱吗?担心硬盘损坏导致数据丢失&#…

作者头像 李华