Fetch file name from path and append to the index name of ES

(KML) #1

Hello All,
Consider that I have path field having value
file {
path => ["D:\ELK\csvs\D20150105_R20160608.csv"]
start_position => "beginning"
So I would like to take the value 20160608 which is date YYYYMMDD varies always from the path D:\ELK\pocdocuments\csvs\D20150105_R20160608.csv which is 8 digit value comes before .csv
Also I need to append that value to the index name
as index =>stock-DD.MM.YYYY which act as timestamp value.

(Magnus Bäck) #2

Use a grok filter to extract the date from the path field that contains the path to the input file from which an event was read. You can then reference the field containing the date in the index option of the elasticsearch output.

(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.