Logstash 根据参考变量更新字段值

时间:2021-06-02 08:59:48

标签: elasticsearch logstash elastic-stack logstash-grok logstash-configuration

使用 Logstash,每次新进程启动时,我都会解析一个包含时间戳值的日志文件。每个进程启动并记录自己的运行时间,从 0 开始到进程完成的时间。我正在尝试在 Kibana 中对此进行可视化,并且希望能够将流程时间更新为为该流程记录的实时时间戳。

样本输入:

12:00:00 Process A starts: 
     0:00:01 Step 1
     0:00:04 Step 2
     ........
     0:10:01 Process Ends
%Random Log lines of no interest
12:10:05 Process B starts:
     0:00:01 Step 1
     0:00:04 Step 2
     ........
     0:10:01 Process Ends
.........

我想解析这个,以便每个时间戳都更新为进程的起始时间戳。

样本输出:

12:00:00 Process A starts: 
     12:00:01 Step 1
     12:00:04 Step 2
     ........
     12:10:01 Process Ends
%Random Log lines of no interest
12:10:05 Process B starts:
     12:10:06 Step 1
     12:10:09 Step 2
     ........
     12:20:06 Process Ends
.........

有没有办法在 Logstash 或 Elasticsearch 中存储此参考值并相应地更新这些字段?我目前正在使用完整的 ELK 堆栈,因此任何线索都会很棒。

0 个答案:

没有答案
相关问题