Can I read input file's metadata (file creation time) through logstash?

Hi, can logstash read the metadata of the input file; say, the file creation time?

Yes, if you use a ruby filter. The file input itself won't adorn events with input file metadata.

Thanks @magnusbaeck. Solved now. Just to help others I am putting the code snippet

ruby{
code => "file = event.get('path');
event.set('filename',file.split('/').last);
event.set('job_datetime', File.ctime(file));"
}

1 Like

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