2017-02-19 55 views
0

我有賽博龍使用的麋鹿棧,我想分析與logstash這個消息,你可以幫我請:如何使用logstash解析捕獲的數據?

"<30>date=2017-02-19 time=21:59:15 timezone=\"IST\" device_name=\"CR200iNG\" device_id=C20313272882-BQ2EUG log_id=010302602002 log_type=\"Firewall\" log_component=\"Appliance Access\" log_subtype=\"Denied\" status=\"Deny\" priority=Information duration=0 fw_rule_id=0 user_name=\"\" user_gp=\"\" iap=0 ips_policy_id=0 appfilter_policy_id=0 application=\"\" application_risk=0 application_technology=\"\" application_category=\"\" in_interface=\"PortF\" out_interface=\"\" src_mac=dd:dd:dd:02:1c:e4 src_ip=192.168.200.9 src_country_code= dst_ip=255.255.255.255 dst_country_code= protocol=\"UDP\" src_port=32771 dst_port=7423 sent_pkts=0 recv_pkts=0 sent_bytes=0 recv_bytes=0 tran_src_ip= tran_src_port=0 tran_dst_ip= tran_dst_port=0 srczonetype=\"\" srczone=\"\" dstzonetype=\"\" dstzone=\"\" dir_disp=\"\" connid=\"\" vconnid=\"\"", 

要明確:

date=2017-02-19 
 
time=21:59:15 
 
timezone=\"IST\" 
 
device_name=\"CR200iNG\" 
 
device_id=C20313272882-BQ2EUG 
 
log_id=010302602002 
 
log_type=\"Firewall\" 
 
log_component=\"Appliance Access\" 
 
log_subtype=\"Denied\" 
 
status=\"Deny\" priority=Information duration=0 
 
fw_rule_id=0 
 
user_name=\"\" 
 
user_gp=\"\" 
 
iap=0 
 
ips_policy_id=0 
 
appfilter_policy_id=0 
 
application=\"\" 
 
application_risk=0 
 
application_technology=\"\" 
 
application_category=\"\" 
 
in_interface=\"PortF\" 
 
out_interface=\"\" 
 
src_mac=c4:04:15:02:1c:e4 
 
src_ip=192.168.200.9 
 
src_country_code= 
 
dst_ip=255.255.255.255 
 
dst_country_code= 
 
protocol=\"UDP\" 
 
src_port=32771 
 
dst_port=7423 
 
sent_pkts=0 
 
recv_pkts=0 
 
sent_bytes=0 
 
recv_bytes=0 
 
tran_src_ip= 
 
tran_src_port=0 
 
tran_dst_ip= 
 
tran_dst_port=0 
 
srczonetype=\"\" 
 
srczone=\"\" 
 
dstzonetype=\"\" 
 
dstzone=\"\" 
 
dir_disp=\"\" 
 
connid=\"\" 
 
vconnid=\"\"" 
 
,

並且可以告訴我如何使用logstash解析捕獲的數據包,因爲cyberoam中有能力捕獲網絡中的數據包,並將此數據發送到logstash,但logstash i不是顯示kibana

問候

回答

1

在格式看這裏的數據,它看起來像the kv filter是最合適的位置。

filter { 
    kv { 
    source => "message" 
    add_tag => [ 'cyberoam' ] 
    } 
} 

kv過濾器將分離出來key1=value key2=value套在一個字符串,並將其轉化領域。這看起來很適合你。鑰匙你知道你不希望包括可與exclude_keys => [ 'key1', 'key2' ]

+0

我使用指定下列: 千伏{ 源=>「syslog_message」 } 發生變異{ 取代=> [「型」,「 %{syslog_program}「] remove_field => [」syslog_message「,」syslog_timestamp「] gsub => ['message','=','=''''] } – user136591