# How to push .log file to elasticsearch

**URL:** https://discuss.elastic.co/t/how-to-push-log-file-to-elasticsearch/151246
**Category:** Logstash
**Created:** [October 5, 2018, 4:24pm UTC](https://discuss.elastic.co/t/how-to-push-log-file-to-elasticsearch/151246 "2018-10-05T16:24:23Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![sundarcse1216](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sundarcse1216/32/29349_2.png) [@sundarcse1216](https://discuss.elastic.co/u/sundarcse1216)
#### Post date: [October 5, 2018, 4:24pm UTC](https://discuss.elastic.co/t/how-to-push-log-file-to-elasticsearch/151246/1 "2018-10-05T16:24:23Z")

</div>

Hi all,  
I have .log file with following content. values separated by [tab].

|2018-10-04-00-15-17|10.1.1.100|8080|10.1.1.105|1|  
|2018-10-04-00-15-20|10.1.1.10|80|10.2.1.15|1|  
|2018-10-04-00-15-31|10.4.1.20|50560|10.1.1.105|1|  
|2018-10-04-00-15-48|10.1.1.10|8080|10.4.1.21|1|  
|2018-10-04-00-15-60|10.1.1.100|8080|10.1.1.105|1|

* * *

I have to give fields name for these values and push it in to elasticsearch.  
The fields should be following.  
**time src port dst count**  
I don't know how to write logstash pipeline logic for push data to elasticsearch.

My Expected output  
{  
"time":"2018-10-04-00-15-17",  
"src":"10.1.1.100",  
"port":"8080",  
"dst":"10.1.1.105",  
"count":1  
}

Thanks,  
Sundar.

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [October 5, 2018, 4:49pm UTC](https://discuss.elastic.co/t/how-to-push-log-file-to-elasticsearch/151246/2 "2018-10-05T16:49:44Z")

</div>

You need

- a file input,
- a csv filter (with the `separator` option set to `\t`), and
- an elasticsearch output.

There are lots of blog posts that show complete examples.

---

<div class="post-metadata">

### Author: ![sundarcse1216](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sundarcse1216/32/29349_2.png) [@sundarcse1216](https://discuss.elastic.co/u/sundarcse1216)
#### Post date: [October 5, 2018, 8:50pm UTC](https://discuss.elastic.co/t/how-to-push-log-file-to-elasticsearch/151246/3 "2018-10-05T20:50:30Z")

</div>

Ok that's fine. How to map the fields with appropriate values?

---

<div class="post-metadata">

### Author: ![ramindia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramindia/32/32459_2.png) [@ramindia](https://discuss.elastic.co/u/ramindia)
#### Post date: [October 5, 2018, 9:18pm UTC](https://discuss.elastic.co/t/how-to-push-log-file-to-elasticsearch/151246/4 "2018-10-05T21:18:51Z")

</div>

there is good grok example for matching.

[https://www.elastic.co/guide/en/logstash/6.2/config-examples.html](https://www.elastic.co/guide/en/logstash/6.2/config-examples.html)

---

<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: [November 2, 2018, 9:18pm UTC](https://discuss.elastic.co/t/how-to-push-log-file-to-elasticsearch/151246/5 "2018-11-02T21:18:53Z")

</div>

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