Skip to content

Instantly share code, notes, and snippets.

@nhnmomonga
Created February 10, 2018 18:55
Show Gist options
  • Save nhnmomonga/97ebc5b2d632493456a042192a447573 to your computer and use it in GitHub Desktop.
Save nhnmomonga/97ebc5b2d632493456a042192a447573 to your computer and use it in GitHub Desktop.
input {
file {
path => "<抽出したログへのパス>"
type => "miraivariant"
start_position => "beginning"
}
}
filter {
csv {
columns => ["timestamp","source_ip","source_port","dist_port"]
separator => " "
convert => {
"timestamp" => "date"
}
}
date {
match => ["timestamp", "UNIX"]
timezone => ["Asia/Tokyo"]
target => "@timestamp"
}
mutate {
convert => { "source_port" => "integer" }
convert => { "dist_port" => "integer" }
}
geoip {
source => "source_ip"
}
}
output {
elasticsearch {
hosts => ["localhost:9200"]
index => "logstash-miraivariant-scan"
}
stdout { codec => rubydebug }
}
@nhnmomonga
Copy link
Author

Logstashが取り込んだファイルの監視に使っているファイルであるsincedbのパスを変えたい場合はinputのfileフィルタ内に

sincedb_path => "<適当なパス>.sincedb"

として追記してください。ログの取り込みに失敗してもここで指定したsincedbを削除してLogstashの再起動をかければ、以前取り込んだファイルと同じファイルでも取り込んでくれます。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment