# Looking for a way to ingest a file and remove it

**URL:** https://discuss.elastic.co/t/looking-for-a-way-to-ingest-a-file-and-remove-it/290343
**Category:** Logstash
**Created:** [November 27, 2021, 7:39pm UTC](https://discuss.elastic.co/t/looking-for-a-way-to-ingest-a-file-and-remove-it/290343 "2021-11-27T19:39:52Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![hagaluly](https://avatars.discourse-cdn.com/v4/letter/h/d78d45/32.png) [@hagaluly](https://discuss.elastic.co/u/hagaluly)
#### Post date: [November 27, 2021, 7:39pm UTC](https://discuss.elastic.co/t/looking-for-a-way-to-ingest-a-file-and-remove-it/290343/1 "2021-11-27T19:39:52Z")

</div>

i created a logstash conf file while back and it ingest the filr and removed it.  
back at the time i did not wanted this behavior but now i do...  
i only forgot how to do it 🙂

can someone direct me to the correct syntax?

---

<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: [November 27, 2021, 8:28pm UTC](https://discuss.elastic.co/t/looking-for-a-way-to-ingest-a-file-and-remove-it/290343/2 "2021-11-27T20:28:17Z")

</div>

Use a file input in read (not tail) mode and set [file\_completed\_action](https://www.elastic.co/guide/en/logstash/current/plugins-inputs-file.html#plugins-inputs-file-file_completed_action) to "delete".

---

<div class="post-metadata">

### Author: ![hagaluly](https://avatars.discourse-cdn.com/v4/letter/h/d78d45/32.png) [@hagaluly](https://discuss.elastic.co/u/hagaluly)
#### Post date: [November 28, 2021, 9:38pm UTC](https://discuss.elastic.co/t/looking-for-a-way-to-ingest-a-file-and-remove-it/290343/4 "2021-11-28T21:38:38Z")

</div>

my config looks like this

```auto
input {
  file {
    path => "/data/elastic/*.json"
    mode => "read"
    file_completed_action => "delete"
    type => "json"
    codec => "json"
    start_position => "beginning"
    file_completed_log_path => "/var/lib/logstash/logged_file.list"
    sincedb_path => "/dev/null"
  }
}
output {
  stdout { codec => "dots"}
  elasticsearch {
    hosts => ["10.10.10.10:9200"]
    index => "jenkins"
    document_type => "_doc"
  }
}

```

i got a nasty error

warning: thread "Converge PipelineAction::Create" terminated with exception (report\_on\_exception is true):  
LogStash::Error: Don't know how to handle `Java::JavaLang::IllegalStateException` for `PipelineAction::Create<main>`  
create at org/logstash/execution/ConvergeResultExt.java:135  
add at org/logstash/execution/ConvergeResultExt.java:60  
converge\_state at /usr/share/logstash/logstash-core/lib/logstash/agent.rb:404  
[ERROR] 2021-11-28 23:31:03.685 [Agent thread] agent - An exception happened when converging configuration {:exception=\>LogStash::Error, :message=\>"Don't know how to handle `Java::JavaLang::IllegalStateException` for `PipelineAction::Create<main>`"}  
[FATAL] 2021-11-28 23:31:03.696 [LogStash::Runner] runner - An unexpected error occurred! {:error=\>#\<LogStash::Error: Don't know how to handle `Java::JavaLang::IllegalStateException` for `PipelineAction::Create<main>`\>, :backtrace=\>["org/logstash/execution/ConvergeResultExt.java:135:in `create'", "org/logstash/execution/ConvergeResultExt.java:60:in `add'", "/usr/share/logstash/logstash-core/lib/logstash/agent.rb:404:in `block in converge\_state'"]}  
[FATAL] 2021-11-28 23:31:03.704 [LogStash::Runner] Logstash - Logstash stopped processing because of an error: (SystemExit) exit  
org.jruby.exceptions.SystemExit: (SystemExit) exit  
at org.jruby.RubyKernel.exit(org/jruby/RubyKernel.java:747) ~[jruby-complete-9.2.19.0.jar:?]  
at org.jruby.RubyKernel.exit(org/jruby/RubyKernel.java:710) ~[jruby-complete-9.2.19.0.jar:?]  
at usr.share.logstash.lib.bootstrap.environment.(/usr/share/logstash/lib/bootstrap

---

<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: [November 28, 2021, 10:38pm UTC](https://discuss.elastic.co/t/looking-for-a-way-to-ingest-a-file-and-remove-it/290343/5 "2021-11-28T22:38:40Z")

</div>

If you enable log.level debug do you get a more informative message?

---

<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: [December 26, 2021, 10:38pm UTC](https://discuss.elastic.co/t/looking-for-a-way-to-ingest-a-file-and-remove-it/290343/6 "2021-12-26T22:38:47Z")

</div>

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