需求:
监听Nginx access log 过滤企业详情接口 抽取出企业ID 然后调用elasticsearch接口对该企业的浏览量加一
221.221.151.191 - - [11/Sep/2019:21:38:58 +0800] "GET /api/companies/201606117 HTTP/1.1" 200 318 "https://my.app.com/companies/i ... ot%3B "Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.75 Mobile Safari/537.36"
==>
201606117
==>
curl -XPOST "http://127.0.0.1:9200/company/ ... ot%3B -H 'Content-Type: application/json' -d'
{
"script" : {
"source": "ctx._source.viewCount ++"
}
}'
看了下Logstash的get started文档
不确定上面的需求 Logstash能不能支持?
监听Nginx access log 过滤企业详情接口 抽取出企业ID 然后调用elasticsearch接口对该企业的浏览量加一
221.221.151.191 - - [11/Sep/2019:21:38:58 +0800] "GET /api/companies/201606117 HTTP/1.1" 200 318 "https://my.app.com/companies/i ... ot%3B "Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.75 Mobile Safari/537.36"
==>
201606117
==>
curl -XPOST "http://127.0.0.1:9200/company/ ... ot%3B -H 'Content-Type: application/json' -d'
{
"script" : {
"source": "ctx._source.viewCount ++"
}
}'
看了下Logstash的get started文档
input {
beats {
port => "5044"
}
}
filter {
grok {
match => { "message" => "%{COMBINEDAPACHELOG}"}
}
geoip {
source => "clientip"
}
}
output {
elasticsearch {
hosts => [ "localhost:9200" ]
}
}
不确定上面的需求 Logstash能不能支持?
0 个回复