Loading...

Backup Elasticsearch Index with Logstash

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
    }
}