ELK之使用packetbeat分析网络包流量
介绍
packbeat是一个开源的实时网络抓包与分析框架,内置了很多常见的协议捕获及解析,如HTTP、MySQL、Redis等。在实际使用中,通常和Elasticsearch以及kibana联合使用,用于数据搜索和分析以及数据展示。
目前Packebeat支持的协议如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ICMP (v4 and v6) DNS HTTP Mysql PostgreSQL Redis Thrift - RPC MongoDB Memcache |
Packetbeat可以运行在应用服务器上或者独自的服务器。当运行在独自服务器上时,需要从交换机的镜像端口或者窃听设备上获取网络流量。
安装系统环境查看
下载rpm包安装
1 | rpm - vih packetbeat - 6.6 . 2 - x86_64.rpm |
修改配置文件
1 | / etc / packetbeat / packetbeat.yml |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | packetbeat.interfaces.device: eth0 packetbeat.flows: timeout: 30s period: 10s packetbeat.protocols: - type : icmp enabled: true - type : amqp ports: [ 5672 ] - type : cassandra ports: [ 9042 ] - type : dhcpv4 ports: [ 67 , 68 ] - type : dns ports: [ 53 ] include_authorities: true include_additionals: true - type : http ports: [ 80 , 8080 , 8000 , 5000 , 8002 ] - type : memcache ports: [ 11211 ] - type : mysql ports: [ 3306 ] - type : pgsql ports: [ 5432 ] - type : redis ports: [ 6379 ] - type : thrift ports: [ 9090 ] - type : mongodb ports: [ 27017 ] - type : nfs ports: [ 2049 ] - type : tls ports: [ 443 ] setup.template.settings: index.number_of_shards: 3 setup.kibana: host: "172.16.90.24:5601" output.elasticsearch: hosts: [ "172.16.90.24:9200" ] processors: - add_host_metadata: ~ - add_cloud_metadata: ~ |
导入kibana模板
1 | packetbeat setup - - dashboards |
kibana查看
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
2018-04-18 SaltStack生产案例-服务部署(redis,mysql,apache+php,haproxy+keepalived)