Http input plugin

logstash作为一个数据输入端。提供http服务,接收客户端的http请求,获取发送的内容。

在config目录下新建文件:

vim config/http-input.yml

复制代码
input {
  http {
    codec => "json"
    ssl => false
    port => 8989
  }
}

filter {
  json {
    source => "message"
  }
}

output {
  stdout { codec => json }
}
复制代码

启动:

bin/logstash -f ./config/http-input.yml 

启动后输出:

复制代码
[root@ss1 logstash-6.5.4]# bin/logstash -f ./config/http-input.yml 
Sending Logstash logs to /root/logstash/logstash-6.5.4/logs which is now configured via log4j2.properties
[2019-04-04T08:52:23,884][WARN ][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified
[2019-04-04T08:52:23,925][INFO ][logstash.runner          ] Starting Logstash {"logstash.version"=>"6.5.4"}
[2019-04-04T08:52:30,433][INFO ][logstash.pipeline        ] Starting pipeline {:pipeline_id=>"main", "pipeline.workers"=>2, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>50}
[2019-04-04T08:52:31,118][INFO ][logstash.pipeline        ] Pipeline started successfully {:pipeline_id=>"main", :thread=>"#<Thread:0x102cff5e run>"}
[2019-04-04T08:52:31,184][INFO ][logstash.inputs.http     ] Starting http input listener {:address=>"0.0.0.0:8989", :ssl=>"false"}
[2019-04-04T08:52:31,291][INFO ][logstash.agent           ] Pipelines running {:count=>1, :running_pipelines=>[:main], :non_running_pipelines=>[]}
[2019-04-04T08:52:31,930][INFO ][logstash.agent           ] Successfully started Logstash API endpoint {:port=>9601}
{"headers":{"request_path":"/","connection":"keep-alive","content_length":"247","request_method":"POST","cache_control":"no-cache","http_version":"HTTP/1.1","postman_token":"7e8dc2ea-f569-42a2-84f4-c53506777c61","content_type":"text/plain","accept_encoding":"gzip, deflate","http_host":"111.111.111.111:8989","http_user_agent":"PostmanRuntime/6.2.5","http_accept":"*/*"},"host":"111.111.111.111","LogType":"maha1","language_type":"heartbeat","LogId":"","ErrorCode":"2","@version":"1","responseLogTime":"2019-04-04 09:40:47.797","srcfile":"c:\\Program.cs","LogMessage":".Net Test","Input":"","Level":"Info","@timestamp":"2019-04-04T08:57:18.780Z"}
复制代码

另外,logstash有个http poller input,是自己主动去http端点采集数据,如果采集spring boot的jmx服务器监控数据。

 

参考:

https://www.elastic.co/guide/en/logstash/current/plugins-inputs-http.html

 

posted @   Bigben  阅读(719)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
点击右上角即可分享
微信分享提示