Source file size and number of lines

(PB) #1


I'm processing raw .xml file using file plugin in Logstash. I'm gathering some metadata about the file like path and host but I would like to get input file size and number of lines as well. Is that possible? If so, how could I do that?


For the number of lines you could query elasticsearch for the number of documents that have particular values for path and host.

You could use an exec input to run "wc -lc" against the files.

You could use an aggregate filter with a code block that incremented a line counter and summed the length of the [message] field for each path.

There are many ways to get what you want.

(PB) #3

Understood @Badger, thanks.