date is not appending to elasticsearch index name while using td-agent

2.9k views Asked by At

i need to store the log to Es index when i use logstash date is getting append ed to index name as logstash.2018-08-06,but when i try to give the custom name as in the flowing conf,its not getting added

</store>
  <store>
  @type elasticsearch
  host X.X.X.X
  port 9200
  logstash_format false
  index_name updatetest.%Y%m%d --> In index name its not replacing with date
  </store>

Here is the index name ,created by above conf updatetest.%Y%m%d --> its should be like updatetest.20180806

Thanks for help in advance

2

There are 2 answers

0
prasad kp On

HI Solved the above issue.

</store>
  <store>
  @type elasticsearch
  host X.X.X.X
  port 9200
  logstash_format true
  logstash_prefix babuji
  </store>
</match>
#</match>
0
AudioBubble On

If you don't want to use the logstash format this also works:

<store>
    @type elasticsearch
    host x.x.x.x
    index_name test.%Y%m
    <buffer tag, time>
        timekey 1h
    </buffer>
    flush_interval 5s
</store>

Now %Y and %m get replaced. Defining a buffer makes the datetime formatting codes available.