# 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:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![basha5](https://avatars.discourse-cdn.com/v4/letter/b/e5b9ba/32.png) [@basha5](https://discuss.elastic.co/u/basha5)\
**Post date:** [September 16, 2019, 8:59am UTC](https://discuss.elastic.co/t/how-to-find-the-filesize-of-a-file-via-logstash/199613/1 "2019-09-16T08:59:51Z")

</div>

Suppose we are loading a file via logstash, how can we display the size of the file using a command in the config file itself?

Thanks in advance.

---

<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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 14, 2019, 9:45am UTC](https://discuss.elastic.co/t/how-to-find-the-filesize-of-a-file-via-logstash/199613/3 "2019-10-14T09:45:46Z")

</div>

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