currently i have filename with the below format
[XXXXXXXX][YYYYYYYYYY][2016_07_21][19_21_12][160721T192103][ZZZZ]AB_RTRT.0.log.
is there a way, i can extract the datetimestamp and index it to a specific field in elastic search.
i used the below grok and i can fetch the year, month and date ([2016_07_21][19_21_12])
grok {
match => ["filename", "%{YEAR:year}%{MONTHNUM:month}%{MONTHDAY:day}"]
add_field => ["date", "%{month}/%{day}/%{year} "]
}
but i am not sure how to fetch the hour, mins and secs.
Always format regular expressions as code. If you look closely at your post you'll note that it doesn't represent reality. All underscores have disappeared.
Unsurprisingly, capturing a time works the same way as capturing a date. I suggest the following expression for capturing the whole timestamp string (including the square brackets):
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.