# Ingesting .gz files in elastic

**URL:** <https://discuss.elastic.co/t/ingesting-gz-files-in-elastic/231910>\
**Category:** Logstash\
**Created:** [May 11, 2020, 12:54am UTC](https://discuss.elastic.co/t/ingesting-gz-files-in-elastic/231910 "2020-05-11T00:54:45Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![hsalim](https://avatars.discourse-cdn.com/v4/letter/h/c67d28/32.png) [@hsalim](https://discuss.elastic.co/u/hsalim)\
**Post date:** [May 11, 2020, 12:54am UTC](https://discuss.elastic.co/t/ingesting-gz-files-in-elastic/231910/1 "2020-05-11T00:54:46Z")

</div>

Hello,  
I know this topic has been discussed in the past, but I am unable to find any new information. So asking again to see if anyone can offer an update.

Is there a way to ingest .gz files in elastic without unzipping first?

Thanks,  
Hamid

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 11, 2020, 1:03am UTC](https://discuss.elastic.co/t/ingesting-gz-files-in-elastic/231910/2 "2020-05-11T01:03:20Z")

</div>

You will still need to decompress them 🙂

---

<div class="post-metadata">

**Author:** ![hsalim](https://avatars.discourse-cdn.com/v4/letter/h/c67d28/32.png) [@hsalim](https://discuss.elastic.co/u/hsalim)\
**Post date:** [May 11, 2020, 1:16am UTC](https://discuss.elastic.co/t/ingesting-gz-files-in-elastic/231910/3 "2020-05-11T01:16:11Z")

</div>

Thanks.

Then what does 'read' mode in file input plugin accomplish?

[https://www.elastic.co/guide/en/logstash/current/plugins-inputs-file.html#\_read\_mode](https://www.elastic.co/guide/en/logstash/current/plugins-inputs-file.html#_read_mode)

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 11, 2020, 1:18am UTC](https://discuss.elastic.co/t/ingesting-gz-files-in-elastic/231910/4 "2020-05-11T01:18:30Z")

</div>

> In this mode the plugin treats each file as if it is content complete, that is, a finite stream of lines and now EOF is significant.

Basically it means that it'll treat the file as if there will be no new data coming into it.

---

<div class="post-metadata">

**Author:** ![hsalim](https://avatars.discourse-cdn.com/v4/letter/h/c67d28/32.png) [@hsalim](https://discuss.elastic.co/u/hsalim)\
**Post date:** [May 11, 2020, 1:27am UTC](https://discuss.elastic.co/t/ingesting-gz-files-in-elastic/231910/5 "2020-05-11T01:27:15Z")

</div>

So best to unzip prior to ingestion by logstash seems to be the right approach?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 11, 2020, 1:29am UTC](https://discuss.elastic.co/t/ingesting-gz-files-in-elastic/231910/6 "2020-05-11T01:29:49Z")

</div>

You can use this to read the zipped files in - [https://www.elastic.co/guide/en/logstash/current/plugins-codecs-gzip\_lines.html](https://www.elastic.co/guide/en/logstash/current/plugins-codecs-gzip_lines.html)

---

<div class="post-metadata">

**Author:** ![hsalim](https://avatars.discourse-cdn.com/v4/letter/h/c67d28/32.png) [@hsalim](https://discuss.elastic.co/u/hsalim)\
**Post date:** [May 11, 2020, 1:33am UTC](https://discuss.elastic.co/t/ingesting-gz-files-in-elastic/231910/7 "2020-05-11T01:33:11Z")

</div>

Thank you. not sure how to explain why the following works then?

input {  
file {  
id =\> "xyz"  
path =\> "/opt/dir1/dir2/local/\*.gz"  
mode =\> "read"  
sincedb\_path =\> "/dev/null"  
}  
}

---

<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:** [June 8, 2020, 1:33am UTC](https://discuss.elastic.co/t/ingesting-gz-files-in-elastic/231910/8 "2020-06-08T01:33:16Z")

</div>

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