logstash-plugins / logstash-input-file

Apache License 2.0
68 stars 101 forks source link

[Windows] Input file is deleted #319

Open paradozed opened 1 year ago

paradozed commented 1 year ago

Logstash deletes the input file when I start it in command line. As soon as the pipeline start. The file specified in the "path" parameter is removed.

import-index.conf:

input {
 file {
   path => ["C:/Users/normuser/logstash-8.6.1/datlog.log"]
   codec => json_lines
   mode => "read"
   start_position => "beginning"
 }
}
output {
 elasticsearch {
  hosts => [ "https://elastic.web:9200"]
  data_stream => true
  data_stream_namespace => "prod"
  data_stream_dataset => "3d"
  ssl => true
  ssl_certificate_verification => false
  api_key => "XXXXXX"
}
 stdout { }
}
  1. Logstash version 8.61
  2. ZIP Windows extracted
  3. How is Logstash being run : Command line "bin/logstash -f config/import-index.conf"

OS : Windows 10

mtuska commented 10 months ago

I ran into a similar issue recently, but when setting the mode to "read" the default action is to delete the files. setting "file_completed_action" to log will change this behaviour. Of note, my environment is Linux so could be different for Windows. https://www.elastic.co/guide/en/logstash/current/plugins-inputs-file.html#plugins-inputs-file-file_completed_action