Source file size and number of lines


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.

Understood @Badger, thanks.

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