# Reading gzipped files and shutting down Logstash once done

**URL:** <https://discuss.elastic.co/t/reading-gzipped-files-and-shutting-down-logstash-once-done/179241>\
**Category:** Logstash\
**Created:** [May 1, 2019, 7:14pm UTC](https://discuss.elastic.co/t/reading-gzipped-files-and-shutting-down-logstash-once-done/179241 "2019-05-01T19:14:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![emilg02](https://avatars.discourse-cdn.com/v4/letter/e/278dde/32.png) [@emilg02](https://discuss.elastic.co/u/emilg02)\
**Post date:** [May 1, 2019, 7:14pm UTC](https://discuss.elastic.co/t/reading-gzipped-files-and-shutting-down-logstash-once-done/179241/1 "2019-05-01T19:14:30Z")

</div>

Hi all,  
My use case is as follows - I need to process gzipped files by demand and I cannot afford having an instance of Logstash continuously running - therefore I must launch an instance, have it process the file, and terminate it once done.

I tried two approaches:

1. Reading the file with the "file" input plugin. This reads the file well, and I have an indication on when the processing is done by using the "file\_completed\_action", but there is no option to execute Logstash on a single file, so I have to manage the state of the Logstash process on my own.

2. Reading the file with  
./logstash -e 'input { stdin {} } output { ANY\_OUTPUT\_FILTER }' \< /file\_path/test.log.gz  
This method will exit after the processing is done, yet reading gzipped files doesn't work at all. I've also tried using the "gzip\_lines" codec, which also unfortunately doesn't work.

Does anyone have any other idea/suggestion that would suit this problem?

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [May 1, 2019, 7:22pm UTC](https://discuss.elastic.co/t/reading-gzipped-files-and-shutting-down-logstash-once-done/179241/2 "2019-05-01T19:22:05Z")

</div>

> [@emilg02](#):
>
> ./logstash -e 'input { stdin {} } output { ANY\_OUTPUT\_FILTER }' \< /file\_path/test.log.gz

If you are willing to do that then why not do this?

```
gunzip -c /file_path/test.log.gz | ./logstash -e 'input { stdin {} } output { ANY_OUTPUT_FILTER }'

```

---

<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:** [May 29, 2019, 7:22pm UTC](https://discuss.elastic.co/t/reading-gzipped-files-and-shutting-down-logstash-once-done/179241/3 "2019-05-29T19:22:11Z")

</div>

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