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