I'm currently using logstash to parse and output the results of several similar commands to elasticsearch, similar to this:
input {
exec {
type => 'hist'
command => '/usr/bin/somecommand'
interval => 900
codec => "json"
}
exec {
type => 'hist'
command => '/usr/bin/somecommand'
interval => 900
codec => "json"
}
exec {
type => 'hist'
command => '/usr/bin/somecommand'
interval => 900
codec => "json"
}
}
output {
if [type] == "hist" {
elasticsearch {
hosts => ["hostname.domain.com:9200"]
index => "monitor-hist-%{+YYYY-MM-dd}"
}
}
}
What I would like is to be able to output to stdout or a file if the connection to elasticsearch fails, like:
if _connectionfails_ {
stdout {
codec => rubydebug
}
}
Is this possible? Or any other recommendations for managing data when elastic is unavailable?