The string interpolation of the time in the index option always uses the value of @timestamp, if @timestamp is the same as logTime, then you may use it, but it will be the time converted back into UTC, which cannot be change.
If I undertand you want to create the indices based on the local time, which is ahead of UTC.
The ruby filter you did you work as it will create a field with your YYYY.MM.dd value, but if you don't want to use a ruby filter you would need to manipulate the date string of the logTime field before using the date filter on it.
The following filters would have the same effect of your ruby filter.
I didn't know that +{YYYY.MM.dd} was based on @timestamp I thought it just got todays date. I see a lot of other people change the @timestamp to the parsed date. But read somewhere when I started learning Logstash that it was bad practice. So we have both, and change the Timestamp field to logTime when creating Data Views in Kibana.
If I undertand you want to create the indices based on the local time, which is ahead of UTC.
That's not the main reason, we have a Logstash listening to a backup log server, the log files are updated every hour, and they don't daily roll at midnight. Also the backup job does not append new lines to the log files, it deletes the old file and makes a whole new file.
So let's say 00:35 the file is updated. Since it is past midnight, all the lines from 23:35-00:00 that is supposed to go into yesterdays index now is pushed into todays new index. But because our backup job overrides the whole file, Logstash thinks it is a new file, and reads the whole file again. Meaning all of yesterdays data is pushed into todays the new index.
We are trying to fix that with:
Using fingerprint filter plugin to sha245 hash the whole line, and use that as the document_id.
Using the parsed date to decide the output index.
Thank you, I will stick to my solution with ruby code, thanks.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.