前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >使用Logstash接收Netflow日志并发送到syslog服务器

使用Logstash接收Netflow日志并发送到syslog服务器

作者头像
heasy3
发布2020-08-02 21:56:54
2K0
发布2020-08-02 21:56:54
举报
文章被收录于专栏:用户7614879的专栏

接受90端口的netflow日志,解析netflow中的源IP、端口、目的IP、端口,并输出syslog到任意端口

netflow日志格式:

{ "netflow" => { "last_switched" => "2020-05-28T02:39:13.781Z", "dst_as" => 0, "in_bytes" => 183, "ipv4_src_addr" => "120.92.11.28", #源IP "protocol" => 6, "ipv4_next_hop" => "172.16.10.10", "input_snmp" => 1, "version" => 9, "flowset_id" => 265, "src_as" => 0, "tcp_flags" => 24, "first_switched" => "2020-05-28T02:39:13.781Z", "flow_seq_num" => 2488, "l4_src_port" => 7823, # 源端口 "output_snmp" => 2, "direction" => 0, "in_pkts" => 1, "ipv4_dst_addr" => "192.168.80.15", #目的IP "src_mask" => 0, "dst_mask" => 16, "flow_sampler_id" => 0, "src_tos" => 0, "l4_dst_port" => 53367 #目的端口 }, "host" => "88.88.88.88", "@timestamp" => 2020-05-28T02:39:37.000Z, "@version" => "1" } 详细字段说明: https://www.ibm.com/support/knowledgecenter/en/SSCVHB_1.2.2/collector/cnpi_collector_v9_fiels_types.html 安装syslog输出插件 bin/logstash-plugin install logstash-output-syslog

代码语言:javascript
复制
input {
  udp {
    port  => 90
    codec => netflow
  }
}
filter{
  mutate {
    rename => { "[netflow][ipv4_src_addr]" => "src_ip"
    "[netflow][l4_src_port]"=> "src_port"
    "[netflow][ipv4_dst_addr]"=>"dst_ip"
    "[netflow][l4_dst_port]"=>"dst_port"
    }
    remove_field => ["netflow"]
  }
}
output {
#  stdout{
#    codec => rubydebug
#  }
  syslog {
    host => "192.168.100.123" 
    port => 16060
 }
}
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2020/05/28 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档