审计日志的Logstash过滤器模式?

问题描述 投票:0回答:1

我正在使用Syslog从我的VM收集所有级别的日志,包括AuditD日志,并保存在Syslog服务器的集中位置。然后,我使用filebeat将所有VM的日志推送到ELK堆栈。同时推动到logstash。我想将以下详细信息与auditD日志分开

1) User Name
2) What command he executed

我使用以下模式将其分开,但是由于AUID以整数形式,所以我无法以字符串形式获取用户名。

使用的图案

type=%{WORD:audit_type} msg=audit\(%{NUMBER:audit_epoch}:%{NUMBER:audit_counter}\): arch=%{NOTSPACE} syscall=%{NUMBER:syscall_number} success=(?<syscall_sucess>(yes|no)) exit=%{NUMBER:syscall_exit_code} %{GREEDYDATA:syscall_arguments} items=%{NUMBER:syscall_path_records} ppid=%{NUMBER:syscall_parent_pid} pid=%{NUMBER:syscall_pid} auid=%{NUMBER:uid_audit} uid=%{NUMBER:running_uid} gid=%{NUMBER:group_id} euid=%{NUMBER:uid_effective} suid=%{NUMBER:uid_set} fsuid=%{NUMBER:uid_fs} egid=%{NUMBER:gid_effective} sgid=%{NUMBER:gid_set} fsgid=%{NUMBER:gid_fs} tty=%{NOTSPACE:tty} ses=%{NUMBER:session_id} comm=\"%{GREEDYDATA:command}\" exe=\"%{GREEDYDATA:exec_file}\" key=\"%{GREEDYDATA:audit_rule}\" SYSCALL=\"%{GREEDYDATA:syscall}\" AUID=\"%{GREEDYDATA:user}\"

我的示例输入

type=SYSCALL msg=audit(1582540425.222:375): arch=c000003e syscall=59 success=yes exit=0 a0=55ea2c3d1f90 a1=55ea2c2e2c20 a2=55ea2c41f570 a3=0 items=2 ppid=16081 pid=16249 auid=1578986719 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=1 comm="sudo" exe="/usr/bin/sudo" key="rootact"#035ARCH=x86_64 SYSCALL=execve AUID="giri" UID="root" GID="root" EUID="root" SUID="root" FSUID="root" EGID="root" SGID="root" FSGID="root"

从上面的示例中,我可以将auid设置为1578986719,但不能将其设置为AUID的giri。

请帮助我获取AUID作为字符串。

linux logstash logstash-grok elk audit-logging
1个回答
0
投票
type=%{WORD:audit_type} msg=audit\(%{NUMBER:audit_epoch}:%{NUMBER:audit_counter}\): arch=%{NOTSPACE} syscall=%{NUMBER:syscall_number} success=(?<syscall_sucess>(yes|no)) exit=%{NUMBER:syscall_exit_code} %{GREEDYDATA:syscall_arguments} items=%{NUMBER:syscall_path_records} ppid=%{NUMBER:syscall_parent_pid} pid=%{NUMBER:syscall_pid} auid=%{NUMBER:uid_audit} uid=%{NUMBER:running_uid} gid=%{NUMBER:group_id} euid=%{NUMBER:uid_effective} suid=%{NUMBER:uid_set} fsuid=%{NUMBER:uid_fs} egid=%{NUMBER:gid_effective} sgid=%{NUMBER:gid_set} fsgid=%{NUMBER:gid_fs} tty=%{NOTSPACE:tty} ses=%{NUMBER:session_id} comm=\"%{GREEDYDATA:command}\" exe=\"%{GREEDYDATA:exec_file}\" key=\"%{GREEDYDATA:audit_rule}\"%{GREEDYDATA} SYSCALL=%{GREEDYDATA:syscall} AUID=\"%{GREEDYDATA:user}\" UID
© www.soinside.com 2019 - 2024. All rights reserved.