Logstash to Re-index Elasticsearch indexes


(Inderjeet Singh) #1

I am trying to re-index all the results in my elasticsearch by using Logstash Elasticsearch input and then some filter and then Logstash Elasticsearch Output plugins. For this I created a logstash-elastic.conf file.

If not running as a service I can explicitly give the command. /logstash-1.5.2/bin/logstash -t -f ./logstash-1.5.2/conf.d/logstash-elastic.conf.

How to run only this specific config file while running Logstash as a service.? Because I have to do the same thing in production where Logstahs runs as as service.


(Inderjeet Singh) #2

Here is my config file

input {  
      elasticsearch {
       hosts => "10.9.32.112"   
       index => "logstash-2015.07.*"      
       scroll => "5m"
       query => '{"query": {"match":{"_type": "debatetable"}}}'
      }
    }
    filter{
     if [type] == "debatetable" {
            translate {
                field => "contentId"
                destination => "slideName"
                dictionary_path => "/home/logstash-1.5.2/slideNames.yaml"
            }
            translate {
                field => "contentId"
                destination => "caseName"
                dictionary_path => "/home/logstash-1.5.2/caseNames.yaml"
            }
        }
    }
    output {
     if "_grokparsefailure" not in [tags]{
        if [type] == "debatetable" {
        elasticsearch {
                host => "10.9.32.112"
                port => "9200"
                protocol => "http"
                document_type => "debatetableNew"
               }
        }
        stdout {codec => rubydebug}
     }
    }

(Magnus B├Ąck) #3

When run as a service (daemon) Logstash is usually configured to read all the configuration files from /etc/logstash/conf.d. Just make sure your logstash-elastic.conf file is stored in that directory (and no other files).


(Inderjeet Singh) #4

This works. Thanks


(system) #5