elasticsearch/kiabana - 分析和可视化交易的总时间?

elasticsearch/kiabana - analyze and visualize total time for transactions?

正在使用 logstash 解析日志文件,这里是 json 发送到 elasticsearch 的样子:

对于包含事务开始时间的日志行,我添加 db_transaction_commit_begin_time 字段和记录时间。

{
                           "message" => "2015-05-27 10:26:47,048  INFO [T:3 ID:26] (ClassName.java:396) - End committing transaction",
                          "@version" => "1",
                        "@timestamp" => "2015-05-27T15:24:11.594Z",
                              "host" => "test.com",
                              "path" => "/abc/xyz/log.logstash.test",
                "logTimestampString" => "2015-05-27 10:26:47,048",
                          "logLevel" => "INFO",
                        "threadInfo" => "T:3 ID:26",
                             "class" => "ClassName.java",
                              "line" => "396",
                        "logMessage" => "End committing transaction",
    "db_transaction_commit_begin_time" => "2015-05-27 10:26:47,048"
}

对于包含事务结束时间的日志行,我添加 db_transaction_commit_end_time 字段和记录时间。

{
                           "message" => "2015-05-27 10:26:47,048  INFO [T:3 ID:26] (ClassName.java:396) - End committing transaction",
                          "@version" => "1",
                        "@timestamp" => "2015-05-27T15:24:11.594Z",
                              "host" => "test.com",
                              "path" => "/abc/xyz/log.logstash.test",
                "logTimestampString" => "2015-05-27 10:26:47,048",
                          "logLevel" => "INFO",
                        "threadInfo" => "T:3 ID:26",
                             "class" => "ClassName.java",
                              "line" => "396",
                        "logMessage" => "End committing transaction",
    "db_transaction_commit_end_time" => "2015-05-27 10:26:47,048"
}

是否可以计算线程信息相同的数据库事务 (db_transaction_commit_end_time - db_transaction_commit_begin_time) 的时间?。我知道聚合可能会有所帮助,但我是新手,无法弄清楚。

如果我以某种方式计算 db_transaction_time 并将其存储在一个变量中。我如何可视化在 kibana 图表中花费的时间?

在 logstash 中使用 elapsed{} 过滤器。