我的Elasticsearch索引与logstash-2015.12.10同名。在不同的服务器上,具有不同的数据现在我只想要Elasticsearch,因此需要将两个服务器的这些数据合二为一。 有可能吗?
答案 0 :(得分:1)
您可以使用Logstash将一个索引从一个主机复制到另一个主机上的同一索引。使用下面的配置,确保替换源主机和目标主机以匹配您的主机名。
文件:copylogs.conf
input {
elasticsearch {
hosts => "server1:9200" <---- the host you want to copy from
index => "logstash-2015.12.10"
}
}
filter {
mutate {
remove_field => [ "@version", "@timestamp" ]
}
}
output {
elasticsearch {
host => "server2" <--- the host you want to copy to
port => 9200
protocol => "http"
manage_template => false
index => "logstash-2015.12.10"
}
}
然后你可以用
简单地启动它bin/logstash -f copylogs.conf