# How to import a nginx log file(from first log, first line) with filebeat to elastic?

**URL:** https://discuss.elastic.co/t/how-to-import-a-nginx-log-file-from-first-log-first-line-with-filebeat-to-elastic/313620
**Category:** Beats
**Tags:** filebeat
**Created:** [September 4, 2022, 11:32am UTC](https://discuss.elastic.co/t/how-to-import-a-nginx-log-file-from-first-log-first-line-with-filebeat-to-elastic/313620 "2022-09-04T11:32:20Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Siavash\_Fazli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/siavash_fazli/32/103915_2.png) [@Siavash\_Fazli](https://discuss.elastic.co/u/Siavash_Fazli)
#### Post date: [September 4, 2022, 11:32am UTC](https://discuss.elastic.co/t/how-to-import-a-nginx-log-file-from-first-log-first-line-with-filebeat-to-elastic/313620/1 "2022-09-04T11:32:20Z")

</div>

Hi guys.  
I configured a filebeat to import nginx log files to elastic.

```auto
# Module: nginx
# Docs: https://www.elastic.co/guide/en/beats/filebeat/7.16/filebeat-module-nginx.html

- module: nginx
  # Access logs
  access:
    enabled: true
    var.paths: ["/var/log/nginx/*access.log", "/var/log/nginx/ *******.com-access.log"]

```

I tested this with a sample log file and it successfully imported the whole file.

But when I changed _var.paths_ to nginx log files(a live log file with a size of 700MB), filebeat started to import the live logs, not from the beginning line of the log file. I need to import the whole file not just since filebeat started.

Does filebeat need extra configuration?

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [September 4, 2022, 2:15pm UTC](https://discuss.elastic.co/t/how-to-import-a-nginx-log-file-from-first-log-first-line-with-filebeat-to-elastic/313620/2 "2022-09-04T14:15:49Z")

</div>

First try this

Go to the data directory see [here](https://www.elastic.co/guide/en/beats/filebeat/current/directory-layout.html)

And clean it out This is where filebeat keep track of what it's loaded.

---

<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 2, 2022, 4:16pm UTC](https://discuss.elastic.co/t/how-to-import-a-nginx-log-file-from-first-log-first-line-with-filebeat-to-elastic/313620/3 "2022-10-02T16:16:08Z")

</div>

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