我有Logstash問題,我開始Logstash不發貨我的日誌文件的尾部,直到我終止logstash過程
bin/logstash -f logstash.conf
的過程,它直到我按ctrl正常,但不是從文件中運行航海日誌+ c終止進程,只有它發送數據到elasticsearch。
我的問題是爲什麼我必須終止進程,開始將所有收集的數據發送到彈性?
logstash.conf:
input {
file {
type => logs
path => "/home/admin/logs/*"
start_position => beginning
sincedb_path => "/home/admin/sincedb"
ignore_older => 0
codec => multiline {
pattern => "^[0-2][0-3]:[0-5][0-9].*"
negate => "true"
what => "previous"
}
}
}
filter {
grok {
match => {
message => "%{NOTSPACE:date}\t+%{INT:done}\t+%{INT:idnumber}\t+SiteID=%{INT:SiteID};DateFrom=%{NOTSPACE:DateFrom};DateTo=%{NOTSPACE:DateTo};RoomCode=%{INT:RoomCode};RatePlanRoomID=%{INT:RatePlanRoomID};DaySetupIDs:%{NOTSPACE:DaySetupIDs};RatePlanID=%{INT:RatePlanID};RatePlanCode=%{INT:RatePlanCode};Calculation=%{WORD:Calculation};IsClosed=%{INT:IsClosed};BaseOccupancy=%{INT:BaseOccupancy};MaxOccupancy=%{INT:MaxOccupancy};MinLOS=%{INT:MinLOS};IsDirtyRate=%{INT:IsDirtyRate};IsDirtyAvail=%{INT:IsDirtyAvail};BasePrice=%{NOTSPACE:BasePrice};ExtraPriceAdult=%{NOTSPACE:ExtraPrice};Currency=%{WORD:Currency};Inventory=%{INT:Inventory};Reservations=%{INT:Reservations};\n+%{GREEDYDATA:Request}\n+%{GREEDYDATA:Response}"
}
}
grok {
match => {
path => "%{GREEDYDATA:pp}/%{INT:filedate}_%{INT:fileid}_%{INT:ChannelID}_%{GREEDYDATA:action}_%{INT:isdone}\.bin"
}
}
mutate {
lowercase => [ "action" ]
}
}
output {
stdout {
codec => rubydebug
}
elasticsearch {
hosts => ["localhost:9200"]
index => "crs-%{SiteID}"
}
}
Logstash:
15:25:10.496 [[main]-pipeline-manager] INFO logstash.pipeline - Pipeline main started
15:25:10.632 [Api Webserver] INFO logstash.agent - Successfully started Logstash API endpoint {:port=>9600}
然後我等待,等待 - 什麼,直到我殺的過程:
^C15:28:33.530 [SIGINT handler] WARN logstash.runner - SIGINT received. Shutting down the agent.
15:28:33.544 [LogStash::Runner] WARN logstash.agent - stopping pipeline {:id=>"main"}
{
"date" => "11:48:49",
"pp" => "/home/admin/logs",
"BasePrice" => "270.00",
"filedate" => "115151",
"idnumber" => "106274275",
"IsClosed" => "0",
"type" => "logs",
"path" => "/home/admin/logs/115151_00_3_SavePrice_1.bin",
"RatePlanID" => "13078",
"MaxOccupancy" => "0",
"Currency" => "PLN",
"@version" => "1",
"host" => "xxxx",
"Reservations" => "0",
"action" => "saveprice",
"Calculation" => "N",
"BaseOccupancy" => "0",
"isdone" => "1",
"RatePlanCode" => "975669",
"fileid" => "00",
"MinLOS" => "1",
"SiteID" => "1709",
"RatePlanRoomID" => "61840",
"ExtraPrice" => ";ExtraPriceChild=",
"Request" => "<?xml version=\"1.0\"?><request>xxx",
"ChannelID" => "3",
"done" => "1",
"DaySetupIDs" => "0=39355996",
"IsDirtyRate" => "1",
"tags" => [
[0] "multiline"
],
"Response" => "<ok></ok>",
"IsDirtyAvail" => "1",
"@timestamp" => 2016-12-29T15:28:33.801Z,
"RoomCode" => "28114102",
"DateFrom" => "2016-12-05",
"Inventory" => "3",
"DateTo" => "2016-12-05"
}
還是一樣的,我的問題是logstash解析日誌,但只有當我終止proc時纔將它發送給elasticsearch ess,發現新數據後不會立即發送 – Mikolaj
@Mikolaj我已更新答案。我想你錯過了'start_position'的引號。如果你可以檢查它並讓我知道? – Kulasangar
@Mikolaj做到了嗎? – Kulasangar