博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
logstash配置
阅读量:6916 次
发布时间:2019-06-27

本文共 2761 字,大约阅读时间需要 9 分钟。

 

input {

#You must define a [type], otherwise you cannot get a field to cut.
tcp {
port => 5045
type => "iis_mail_log"
codec => "json"
#start_position => "beginning"
}
#Configure syslog type,Collect Fortigate Firewall log
syslog {
port => 514
type => "syslog_net"
}

#Configure syslog type,the same to up.

#tcp {
# port => 5140
# type => syslog
#}

#udp {

# port => 5140
# type => "syslog"
#}

 

}

filter {

if [type] in ["iis_mail_log","iis_oa_log"]{
geoip {
source => "c-ip"
target => "geoip"
database => "/data/app/logstash-6.2.2/data/GeoLite2-City.mmdb"
fields => ["city_name","region_name","country_name"]
}
}

#Filter ldap log

if [type] == "sec_ldap_log" {
json {
source => "message"
}
if [SourceModuleName] == "seclogas" {
mutate {
replace => [ "message", "%{Message}" ]
}
mutate {
remove_field => [ "Message" ]
}
}
}

# Remove IPv6 prefix from IPAddress if not used
if [IpAddress] =~ "ffff" {
grok {
match => ["IpAddress", "^.*?\::ffff:%{GREEDYDATA:IpAddress}$"]
overwrite => ["IpAddress"]
}
}

#Identify machine accounts
if [TargetUserName] =~ /\$/ {
mutate {
add_field => { "machine" => "true" }
}
} else {
mutate {
add_field => { "machine" => "false" }
}
}

# # Extract username from email
# if [TargetUserName] =~ /\@/ {
# grok {
# match => ["TargetUserName", "%{WORD:TargetUserName}"]
# overwrite => ["TargetUserName"]
# }
# }

# Filter Fortigate firewall log
if [type] == "syslog_net" {

grok {

match => ["message","<%{POSINT:syslog_index}>%{GREEDYDATA:message}"]
overwrite => ["message"]
}

kv {

source => "message"
field_split => ","
value_split => "="
trim_value => "\""
include_keys => ["date","time","subtype","srcip","srcport","srcintf","dstip","dstport","dstintf","action","trandisp","transip","service"]
#target => "kv"
}

mutate{

add_field => ["fg_time","%{date} %{time}"]
remove_field => ["date","time"]
# rename => ["type","fg_type"]
# rename => ["subtype","fg_subtype"]
# add_field => ["type" => "syslog_net"]
#convert => ["rcvdbyte" => "interger"]
#convert => ["sentbyte" => "integer"]

}

#date {
# match => ["temp_time","yyyy-MM-dd HH:mm:ss"]
# # timezone => "UTC"
# target => "@timestamp"
#}

 

}

}

output {
if [type] == "iis_mail_log" {
#Output to redis
redis {
host => ["2.2.2.2:6379"]
key => "logstash"
data_type => "channel"
codec => "json"
}
Output to elasticasearch
elasticsearch {
action => "index"
hosts => ["1.1.2.1:9200","1.1.2.2:9200"]
index => "iis_mail_%{+YYYY-MM}"
codec => "json"
}
}

if [type] == "iis_oa_log"{
elasticsearch {
action => "index"
hosts => ["1.1.2.1:9200","1.1.2.2:9200"]
#index => "logstash-oa-access0529-%{+YYYY-MM}"
index => "iis_oa_%{+YYYY-MM}"
codec => "json"
}
}

if [type] == "syslog_net"{
elasticsearch {
action => "index"
hosts => ["1.1.2.1:9200","1.1.2.2:9200"]
index => "net_fw_%{+YYYY-MM}"
codec => "json"
}
}

}

 

转载地址:http://ugxcl.baihongyu.com/

你可能感兴趣的文章
php内核分析(六)-opcode
查看>>
twisted: echo server
查看>>
iOS地图的注释(Annotation)
查看>>
存储过程中递归调用
查看>>
android INSTALL_FAILED_INSUFFICIENT_STORAGE错误
查看>>
android开发之第三方集成之OAUTH教程篇
查看>>
spring+mybatis 多数据源整合
查看>>
HTML5 网络拓扑图整合 OpenLayers 实现 GIS 地图应用
查看>>
php 两种短网址生成方法
查看>>
AOP - PostSharp 2.0
查看>>
Spring测试框架JUnit4.4
查看>>
openSUSE 12.1下搭建Web服务器
查看>>
Contact Manager Web API 示例[2] Web API Routing
查看>>
用luasocket读取双色球中奖号码
查看>>
C#中ref和out的使用小结
查看>>
Extjs4 中的gird
查看>>
错排-HDU 2049 递推的应用
查看>>
参数化查询为什么能够防止SQL注入
查看>>
AlertDialog.Builder弹出对话框
查看>>
HDUOJ -----1686
查看>>