Include monotonically increasing value in logstash field?

后端 未结 3 583
面向向阳花
面向向阳花 2021-01-15 05:01

I know there\'s no built in \"line count\" functionality while processing files through logstash (for various, understandable and documented reasons). But - there should be

3条回答
  •  不知归路
    2021-01-15 05:45

    this is another choice to slove the problem,this work for me,thanks to the answer from the previous person about thread safe. i use seq field to sort my desc

    this is my configure

    logstash.conf
    
    filter {
      ruby {
        code => 'event.set("seq", Time.now.strftime("%N").to_i)'           
            }
    }
    
    logstash.yml
    
    pipeline.batch.size: 200
    pipeline.batch.delay: 60
    pipeline.workers: 1
    pipeline.output.workers: 1
    

提交回复
热议问题