我的ELK搭建笔记(Windows 日志收集)

2017-02-14 26,457

1

 

我的ELK搭建笔记

(Windows 日志收集)

目录预览

 

1、需求说明

2、Winlogbeat工具介绍

3、安装部署

3.1 下载

3.2 配置

3.3 安装

3.4 启动

4、验证

5、性能

6、维护

7、Troubleshooting

一,需求说明

 

收集和存储Windows AD服务器关键系统日志,应对安全审计要求。
基于Windows账户登录日志进行安全事件分析。

二,Winlogbeat工具介绍

 

Elasticsearch官方提供的轻量级Windows事件日志转发代理。

日志数据流:Winlogbeat ---> Logstash ---> Elasticsearch

采取这样的部署方式是基于如下考虑:

  • Windows 服务器部署后就不需要再做任何变更了(毕竟是线上AD服务器,隔三差五去动配置要掉脑袋的!)
  • 如果对默认 Window 日志映射不满意,可以在 logstash 上重新调整

三,安装部署

 

官方地址:https://www.elastic.co/downloads/beats/winlogbeat

下载Winlogbeat压缩包,解压后部署在Windows Server 2008 R2服务器的目录。程序主目录【C:\Program Files\winlogbeat\】,效果如下:

2

3.2 配置

 

编辑文件【winlogbeat.conf】,设置日志收集参数、转发服务器参数等。

C:\Program Files\winlogbeat\winlogbeat.yml

# The supported keys are name (required), tags, fields, fields_under_root,

# forwarded, ignore_older, level, event_id, provider, and include_xml. Please

# visit the documentation for the complete details of each option.

# https://go.es.io/WinlogbeatConfig

# 收集三类日志:Application/Security/System,72小时前的日志忽略。以下默认,无需修改

winlogbeat.event_logs:

- name: Application

ignore_older: 72h

- name: Security

- name: System

# 注释所有Elasticsearch相关的配置参数

#-------------------------- Elasticsearch output ------------------------------

#output.elasticsearch:

# Array of hosts to connect to.

#hosts: ["localhost:9200"]

# Optional protocol and basic auth credentials.

#protocol: "https"

#username: "elastic"

#password: "changeme"

# 配置Logstash相关参数,默认只需要配置hosts

#----------------------------- Logstash output --------------------------------

output.logstash:

# The Logstash hosts

hosts: ["1.1.1.1:5044"]

其中1.1.1.1时远程logstash服务器的IP地址,实际部署时请设置为正确的IP参数。

请确保防火墙策略允许Windows AD服务器能够访问到logstash服务器IP的TCP5044端口。

3.3 安装

 

启动powershell工作台:

切换到【C:\Program Files\winlogbeat\】

执行命令【.\install-service-winlogbeat.ps1】安装服务。

3

3.4 启动

 

命令行执行【net start winlogbeat】;

启动日志收集代理服务

4

四,验证

 

本地确认winlogbeat服务工作正常
程序自身日志正常
远程logstash工作正常
Kibana能搜索到Windows日志

5

 

五,性能

 

在没有日志产生的情况下,winlogbeat进程工作内存9M,有日志产生的情况下,小于100M内存。

7

六,维护

 

Windows Service维护

;启动服务

net start winlogbeat

;停止服务

net stop winlogbeat

;卸载服务

powershell "C:\Program Files\winlogbeat\uninstall-service-winlogbeat.ps1"

七,Troubleshooting

 

某些Windows Server服务器默认是禁止启用powershell的,因此安装过程可能会遇到如下问题。

无法加载文件 C:\Program Files\winlogbeat\install-service-winlogbeat.ps1,因为在此系统中禁止执行脚本。有关详细信息,请参阅 "get-help about_signing"。

所在位置 行:1 字符: 33

+ .\install-service-winlogbeat.ps1 <<<<

+ CategoryInfo : NotSpecified: (:) [], PSSecurityException

+ FullyQualifiedErrorId : RuntimeException

针对该异常情况,建议:

临时降低powershell执行检查要求,允许执行非签名的shell文件
安装部署winlogbeat
还原powershell执行安全配置
在powershell中全流程操作如下:

PS C:\Users\Administrator> cd "C:\Program Files\winlogbeat"

PS C:\Program Files\winlogbeat> set-executionpolicy remotesigned

PS C:\Program Files\winlogbeat> .\install-service-winlogbeat.ps1

PS C:\Program Files\winlogbeat> net start winlogbeat

PS C:\Program Files\winlogbeat> set-executionpolicy restricted

6

【本文原文:我的ELK搭建笔记(Windows 日志收集) 入驻安全脉搏账号发布 转载请注明来自安全脉搏】

本文作者:VSRC

本文为安全脉搏专栏作者发布,转载请注明:https://www.secpulse.com/archives/55636.html

Tags:
评论  (2)
快来写下你的想法吧!
  • QQ:191801737 2017-03-09 11:55:51

    博主 有没有遇到过 AD日志过多,在kibana上面看到 日志过来有延迟的情况?

  • alex 2017-08-01 16:48:51

    到启动服务时出错:“服务没有响应控制功能。”

VSRC

文章数:28 积分: 50

感谢各位安全专家长期关注唯品会安全。

安全问答社区

安全问答社区

脉搏官方公众号

脉搏公众号