I have problem with Logstash, I start the process with
bin/logstash -f logstash.conf
and it runs properly but not ship logs from files until I press ctrl+c to terminate process, only then it sends data to elasticsearch.
My question is why I must terminate process to start sending all collected data to elastic?
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}
then I waiting and waiting - nothing until I kill process:
^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"
}