Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Re-setting Logstash state

I am currently under development and using the following configuration for a logstash agent:

input {
  file {
    type => "access_log"

    # Wildcards work, here :)
    path => [ "/root/isaac/vuforia_logs/access_logs/gw_access_log.2014-02-19.00.log"]

    start_position => "beginning"
  }


} 

filter {
 if [type] == "access_log" {
  grok { 
    pattern  => "\[%{DATA:my_timestamp}\] %{IP:client} %{WORD:method} %{URIPATHPARAM:request} \[%{DATA:auth_data}\] \[%{DATA:another_timstamp}\] %{NUMBER:result_code} %{NUMBER:duration} %{NUMBER:bytes}"
  }
 }
}



output {
  stdout { debug => true }
  elasticsearch_http { 
        host => "192.168.79.128"
        }

The very first time it reads the file, it will process it and log to stdout and elasticsearch. The problem is when I restart logstash it does not do anything which I presume is because it kept the last position where logstash stopped last time. I am interesting in resetting logstash such that it would re-process the file from the beginning. This is for development and testing purposes, is there a way to reset/clean the logstash state?

Thx

like image 305
isaac.hazan Avatar asked Feb 24 '14 08:02

isaac.hazan


People also ask

How to reset logstash?

If you want to reset/clean it, you can delete all the . sincedb_* in your $HOME. Then when you restart logstash, it will read from the beginning.

How do I check logstash status?

The most basic thing to check is the status of the Logstash status: sudo service logstash status.

What is Sincedb_path in logstash?

sincedb_path just needs to be a directory where logstash has write permission for the registry. sincedb_write_interval defines how often logstash should write the sincedb registry. A larger value puts you at risk in logstash were to crash.

Can logstash have multiple inputs?

Only use input once.


1 Answers

Logstash will record a sincedb for the input file. The default path is your $HOME directory. You can visit here for more information.

If you want to reset/clean it, you can delete all the .sincedb_* in your $HOME. Then when you restart logstash, it will read from the beginning.

like image 195
Ben Lim Avatar answered Oct 03 '22 21:10

Ben Lim