title: Using Redis key as Elasticsearch index name
body: <p>I am attempting to use a logstash indexer to move data from redis to elasticsearch.</p>
  
  <p>On the input to redis end, I give a 'key' to one set of logs from logstash output.</p>
  
  <pre><code> redis
      {
      host           =&gt; "server
      port            =&gt; "7379"
      data_type       =&gt; "list"
      key             =&gt; "aruba"
      }
  </code></pre>
  
  <p>On input end , I read each keys in the input.</p>
  
  <pre><code>input
  {
      redis
      {
          host        =&gt; "localhost"
          port        =&gt; "6379"
          data_type   =&gt; "list"
          type        =&gt; "redis-input"
          key         =&gt; "logstash"
          codec       =&gt; "json"
          threads     =&gt; 32
          batch_count =&gt; 1000
          #timeout     =&gt; 10
      }
      redis
      {
          host        =&gt; "localhost"
          port        =&gt; "6379"
          data_type   =&gt; "list"
          type        =&gt; "redis-input"
          key         =&gt; "aruba"
          codec       =&gt; "json"
          threads     =&gt; 32
          batch_count =&gt; 1000
          #timeout     =&gt; 10
      }
  }
  </code></pre>
  
  <p>and I am attempting to use the key in the logstash to write to index. i.e.</p>
  
  <p>aruba-2017.24.10. something like that, but the output always goes to logstash. I tried</p>
  
  <pre><code>if[redis.key] == "xyz"
  {
      elasticsearch {index =&gt; "xyz-%{time}"}
  }
  </code></pre>
  
  <p>or if[key] == "xyz" .... 
  also tried </p>
  
  <pre><code>elasticsearch
  {
      index =&gt; "%{key}-%{time}"
  } 
  </code></pre>
  
  <p>and elasticsearch{index => "%{redis.key}-%{time}"}</p>
  
  <p>etc. None of it seems to work.</p>