Loading...

Backup Elasticsearch Index with Logstash

:heavy_exclamation_mark: This post is older than a year. Consider some information might not be accurate anymore. :heavy_exclamation_mark:

Used:   elasticsearch v6.2.4 

Index data in Elasticsearch can be easily exported in json encoded text with Logstash.

  • As input use some nodes of your elasticsearch cluster.
  • For the stdout output use the codecs plugin to indicate the progress.
  • In the file output enable gzip if you are dealing with large amount of data.
  • The default codec is json_lines.
input{
    elasticsearch {
        hosts => [ "es1", "192.168.1.232" ]
        index => "payments-2018.03.28"
        user => "export_user"
        password => "export_me"
    }
}
output {
    stdout { codec => "dots" }
    file {
      path => "/var/opt/export/payments-2018-03-03.json"
      # gzip => true
    }
}
Please remember the terms for blog comments.