# Reading from a file and immediately writing to another file

**URL:** <https://discuss.elastic.co/t/reading-from-a-file-and-immediately-writing-to-another-file/208068>\
**Category:** Logstash\
**Created:** [November 15, 2019, 12:00pm UTC](https://discuss.elastic.co/t/reading-from-a-file-and-immediately-writing-to-another-file/208068 "2019-11-15T12:00:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![user112233](https://avatars.discourse-cdn.com/v4/letter/u/e19adc/32.png) [@user112233](https://discuss.elastic.co/u/user112233)\
**Post date:** [November 15, 2019, 12:00pm UTC](https://discuss.elastic.co/t/reading-from-a-file-and-immediately-writing-to-another-file/208068/1 "2019-11-15T12:00:45Z")

</div>

I'm trying to configure logstash to read data from one file, and write to another file.  
This simple task is for a test.

It's simple (C:\Bitnami\elk\logstash\conf\test1.conf):

```
input {
  file {
    path => "C:\Upload\DNS_log_03.log"
    sincedb_path => "C:\Upload\null"
    start_position => "beginning"
    file_completed_action => "log"
    file_completed_log_path => "C:\Upload\log.log"
  }
}
 
output {
  file {
    path => "C:\Upload\outfile.log"
    codec => "json"
  }
}

```

But that does not work.  
The file "C: \ Upload \ log.log" is created, zero length.  
The file "C: \ Upload \ null" is created, zero length.

Log in debug mode does not write anything intelligible.

And that is all.

The file "C:\Upload\outfile.log" is not created.

What am I doing wrong?

---

<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 15, 2019, 3:23pm UTC](https://discuss.elastic.co/t/reading-from-a-file-and-immediately-writing-to-another-file/208068/2 "2019-11-15T15:23:21Z")

</div>

> [@user112233](#):
>
> path =\> "C:\Upload\DNS\_log\_03.log"

Do not use backslash in the path option of a file input, use forward slash.

---

<div class="post-metadata">

**Author:** ![user112233](https://avatars.discourse-cdn.com/v4/letter/u/e19adc/32.png) [@user112233](https://discuss.elastic.co/u/user112233)\
**Post date:** [November 18, 2019, 6:12am UTC](https://discuss.elastic.co/t/reading-from-a-file-and-immediately-writing-to-another-file/208068/3 "2019-11-18T06:12:58Z")

</div>

> [@Badger](#):
>
> Do not use backslash in the path option of a file input, use forward slash.

This does not work...

C:\Bitnami\elk\logstash\conf\test1.conf  
input {  
file {  
path =\> "C:\Upload\DNS\_log\_03.log"  
sincedb\_path =\> "C:\Upload\null"  
start\_position =\> "beginning"  
file\_completed\_action =\> "log"  
file\_completed\_log\_path =\> "C:\Upload\log.log"  
}  
}

output {  
file {  
**path =\> "C:/Upload/outfile.log"**  
#codec =\> "json"  
}  
}

logstash-plain.log  
...  
[2019-11-18T09:06:58,418][DEBUG][logstash.outputs.file] config LogStash::Outputs::File/@path = "C:/Upload/outfile.log"  
...  
[2019-11-18T09:06:59,105][INFO][logstash.agent] Successfully started Logstash API endpoint {:port=\>9600}  
[2019-11-18T09:06:58,590][DEBUG][org.logstash.config.ir.CompiledPipeline][main] Compiled output  
P[output-file{"path"=\>"C:/Upload/outfile.log"}|[str]pipeline:12:3:```  
file {  
path =\> "C:/Upload/outfile.log"  
#codec =\> "json"  
}

````auto
 into
 org.logstash.config.ir.compiler.ComputeStepSyntaxElement@c96a6eaa
[2019-11-18T09:06:58,590][DEBUG][org.logstash.config.ir.CompiledPipeline][main] Compiled output
 P[output-file{"path"=>"C:/Upload/outfile.log"}|[str]pipeline:12:3:```
file {
    path => "C:/Upload/outfile.log"
    #codec => "json"
  }
```]
 into
 org.logstash.config.ir.compiler.ComputeStepSyntaxElement@c96a6eaa
[2019-11-18T09:06:58,605][DEBUG][org.logstash.config.ir.CompiledPipeline][main] Compiled output
 P[output-file{"path"=>"C:/Upload/outfile.log"}|[str]pipeline:12:3:```
file {
    path => "C:/Upload/outfile.log"
    #codec => "json"
  }
```]
 into
 org.logstash.config.ir.compiler.ComputeStepSyntaxElement@c96a6eaa
[2019-11-18T09:06:58,605][DEBUG][org.logstash.config.ir.CompiledPipeline][main] Compiled output
 P[output-file{"path"=>"C:/Upload/outfile.log"}|[str]pipeline:12:3:```
file {
    path => "C:/Upload/outfile.log"
    #codec => "json"
  }
```]
 into
 org.logstash.config.ir.compiler.ComputeStepSyntaxElement@c96a6eaa
[2019-11-18T09:07:00,465][DEBUG][logstash.outputs.file] Starting flush cycle
...

And, the file C:\Upload\outfile.log is also not created.

Any more ideas?
````

---

<div class="post-metadata">

**Author:** ![user112233](https://avatars.discourse-cdn.com/v4/letter/u/e19adc/32.png) [@user112233](https://discuss.elastic.co/u/user112233)\
**Post date:** [November 18, 2019, 6:25am UTC](https://discuss.elastic.co/t/reading-from-a-file-and-immediately-writing-to-another-file/208068/4 "2019-11-18T06:25:30Z")

</div>

Work:

input {  
file {  
path =\> "C:/Upload/DNS\_log\_03.log"  
sincedb\_path =\> "C:/Upload/null"  
start\_position =\> "beginning"  
file\_completed\_action =\> "log"  
file\_completed\_log\_path =\> "C:/Upload/log.log"  
}  
}

output {  
file {  
path =\> "C:/Upload/outfile.log"  
#codec =\> "json"  
}  
}

thanks )

---

<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 16, 2019, 6:25am UTC](https://discuss.elastic.co/t/reading-from-a-file-and-immediately-writing-to-another-file/208068/5 "2019-12-16T06:25:33Z")

</div>

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