# How to find the filesize of a file via logstash

**URL:** <https://discuss.elastic.co/t/how-to-find-the-filesize-of-a-file-via-logstash/199613>\
**Category:** Logstash\
**Created:** [September 16, 2019, 8:59am UTC](https://discuss.elastic.co/t/how-to-find-the-filesize-of-a-file-via-logstash/199613 "2019-09-16T08:59:51Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![harshbajaj16](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/harshbajaj16/32/44970_2.png) [@harshbajaj16](https://discuss.elastic.co/u/harshbajaj16)\
**Post date:** [September 16, 2019, 9:40am UTC](https://discuss.elastic.co/t/how-to-find-the-filesize-of-a-file-via-logstash/199613/2 "2019-09-16T09:40:17Z")

</div>

Hi @basha5,

There is no specific command in logstash to check the size of file. However, i found a post where they have mentioned that we can do the same through aggregate filter in logstash to calculate the file size with code block.

Please refer below post it may be helpful for you.

> [@Source file size and number of lines](https://discuss.elastic.co/t/source-file-size-and-number-of-lines/180986):
>
> Hello, 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? Thanks!

Regards,  
Harsh Bajaj

---

_[View the full topic](https://discuss.elastic.co/t/how-to-find-the-filesize-of-a-file-via-logstash/199613)._
