# What is the best way to delete in elastic search and reparse an apache log file

**URL:** <https://discuss.elastic.co/t/what-is-the-best-way-to-delete-in-elastic-search-and-reparse-an-apache-log-file/162865>\
**Category:** Elasticsearch\
**Created:** [January 3, 2019, 6:46pm UTC](https://discuss.elastic.co/t/what-is-the-best-way-to-delete-in-elastic-search-and-reparse-an-apache-log-file/162865 "2019-01-03T18:46:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![elk\_dni\_1](https://avatars.discourse-cdn.com/v4/letter/e/82dd89/32.png) [@elk\_dni\_1](https://discuss.elastic.co/u/elk_dni_1)\
**Post date:** [January 3, 2019, 6:46pm UTC](https://discuss.elastic.co/t/what-is-the-best-way-to-delete-in-elastic-search-and-reparse-an-apache-log-file/162865/1 "2019-01-03T18:46:27Z")

</div>

path is available in ES records as one field(from where the record is got)

## Deleting from Elastic search -

Currently I am doing this way -

curl -s -X POST [http://localhost:9200/test-log-\*/\_delete\_by\_query?q=path:log1234](http://localhost:9200/test-log-*/_delete_by_query?q=path:log1234)

## Reparse log file -

I have a logstash process running all the time, so

remove and copy the file in logstash path-

cd \<logstash\_path\_dir\>;rm log1234; cp \<from\_source\> log1234

This works when I do delete and wait until it becomes zero records in ES and do reparse manually (only some times).  
When ran as a script its not working ... Do I need to add more wait (sleep) in script for ES to flush the data?

---

<div class="post-metadata">

**Author:** ![Charles.w](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/charles.w/32/15486_2.png) [@Charles.w](https://discuss.elastic.co/u/Charles.w)\
**Post date:** [January 3, 2019, 7:35pm UTC](https://discuss.elastic.co/t/what-is-the-best-way-to-delete-in-elastic-search-and-reparse-an-apache-log-file/162865/2 "2019-01-03T19:35:03Z")

</div>

Hi elk\_dni1,

What versions are you using ? How is configured your logstash input plugin ? What OS are you running logstash on ?

Best regards,

Charles Casadei.

---

<div class="post-metadata">

**Author:** ![elk\_dni\_1](https://avatars.discourse-cdn.com/v4/letter/e/82dd89/32.png) [@elk\_dni\_1](https://discuss.elastic.co/u/elk_dni_1)\
**Post date:** [January 3, 2019, 7:37pm UTC](https://discuss.elastic.co/t/what-is-the-best-way-to-delete-in-elastic-search-and-reparse-an-apache-log-file/162865/3 "2019-01-03T19:37:34Z")

</div>

Linux OS, ES 6.0.0.0

Input -

input {  
file {  
type =\> "abc"  
path =\> "/app/xyz/es-data/app-logs-6/abc/\*access\*"  
codec =\> plain { charset =\> "ISO-8859-1" }  
exclude =\> "\*.gz"  
sincedb\_path =\> "/app/xyz/es-data/metadata-6/sincedb/sincedb\_qwert"  
max\_open\_files =\> 10000  
ignore\_older =\> 0  
}

To make it new inode, I am removing file and copying again, but still logstash is not picking...

---

<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:** [January 31, 2019, 7:37pm UTC](https://discuss.elastic.co/t/what-is-the-best-way-to-delete-in-elastic-search-and-reparse-an-apache-log-file/162865/4 "2019-01-31T19:37:39Z")

</div>

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