0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

super_mediatorを改造せずにlogstashのフィルタで@timestampの値をflows.flowStartMillisecondsにする

Last updated at Posted at 2018-02-04

pcapファイルをIPfixに変換、ELKで可視化
https://qiita.com/t_umeno/items/999a9f1e76b9cffa1053
の補足です。
上記URLではsuper_mediatorを改造しましたが、
super_mediatorを改造せずに
logstashのフィルタで@timestampの値をflows.flowStartMillisecondsにする事ができます。

matchのフォーマットの部分に

"yyyy-MM-dd HH:mm:ss.SSS"

と書けば変換できます。
下記の例ではsuper_mediator改造して、ISO8601形式に変更した場合も考慮しています。
2018/02/25 追記
timezone としてUTCを指定する様にしました。timezoneを指定しないとOS
で指定したtimezoneで時刻が取り扱われてしまいます。
例:

filter {
    if ([type] == "ipfix") {
        grok {
            match => ["path", "(?<index>yaf.\d{8,14})\.json$" ]
        }
        date {
            locale => "en"
            match => ["[flows][flowStartMilliseconds]", "yyyy-MM-dd HH:mm:ss.SSS", "ISO8601"]
            target => "@timestamp"
            timezone => "UTC"
        }
        date {
            locale => "en"
            match => ["[flows][flowStartMilliseconds]", "yyyy-MM-dd HH:mm:ss.SSS", "ISO8601"]
            target => "[flows][flowStartMilliseconds]"
            timezone => "UTC"
        }
        date {
            locale => "en"
            match => ["[flows][flowEndMilliseconds]", "yyyy-MM-dd HH:mm:ss.SSS", "ISO8601"]
            target => "[flows][flowEndMilliseconds]"
            timezone => "UTC"
        }
    }
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?