http插件      

  Logstash 中的 HTTP 输入插件用于通过 HTTP 请求接收数据。它可以让 Logstash 充当一个 HTTP 服务器,接收来自客户端的 JSON、XML 或纯文本格式的数据。

一.安装logstash

​​​​​​Download Filebeat • Lightweight Log Analysis | Elastic3​​​​​​​ehttps://www.elastic.co/downloads/beats/filebeat

二.编辑logstash.conf配置文件 

[root@k8s-master conf.d]# cat http_test.conf 
input {
  http {
    host => "0.0.0.0"
    port => 8080
  }
}

output {
  stdout {
    codec => rubydebug
  }
}

 三.运行logstash

[root@k8s-master conf.d]# logstash -f /etc/logstash/conf.d/http_test.conf 

 四.发送测试数据到 HTTP输入插件

[root@k8s-master elastic-agent]# curl -X POST "http://192.168.9.128:8080" -H 'Content-Type: application/json' -d '{"message": "Hello, Logstash!"}'
ok

五.输出验证

 graphite插件

        Logstash 中的 Graphite 输入插件用于接收来自 Graphite 的指标数据。Graphite 是一个开源监控工具,通常用于收集和存储时间序列数据。

 编辑logstash.conf配置文件 

[root@k8s-master conf.d]# cat graphite.conf 
input {
  graphite {
    host => "0.0.0.0"
    port => 2003
  }
}

output {
  stdout {
    codec => rubydebug
  }
}

 发送测试数据

[root@k8s-master elastic-agent]# echo "test.metric 42 $(date +%s)" | nc -w1 192.168.9.128 2003

 输出验证

 

Logo

中国智能体开发者社区,聚焦智能体与大模型开发,提供前沿资讯、实用工具链、开源项目及行业案例。通过技术沙龙、开发者大赛等活动,促进经验交流与协作,助力开发者快速构建创新智能应用。

更多推荐