# Is it possible to write to /dev/stdout using file output?

**URL:** https://discuss.elastic.co/t/is-it-possible-to-write-to-dev-stdout-using-file-output/32935
**Category:** Beats
**Tags:** beats-development
**Created:** [October 25, 2015, 4:00pm UTC](https://discuss.elastic.co/t/is-it-possible-to-write-to-dev-stdout-using-file-output/32935 "2015-10-25T16:00:03Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![mrkschan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mrkschan/32/5386_2.png) [@mrkschan](https://discuss.elastic.co/u/mrkschan)
#### Post date: [October 25, 2015, 4:00pm UTC](https://discuss.elastic.co/t/is-it-possible-to-write-to-dev-stdout-using-file-output/32935/1 "2015-10-25T16:00:03Z")

</div>

I was trying to use /dev/stdout as the beats output but failed to do so.

The config is like ...

```auto
### File as output
  file:
    # Enabling file output.
    enabled: true

    # Path to the directory where to save the generated files. The option is mandatory.
    path: "/dev"

    # Name of the generated files. The default is `topbeat` and it generates...
    filename: stdout

```

BTW, I just hope to use /dev/stdout for easier debugging of the beats output.

---

<div class="post-metadata">

### Author: ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)
#### Post date: [October 26, 2015, 10:35am UTC](https://discuss.elastic.co/t/is-it-possible-to-write-to-dev-stdout-using-file-output/32935/2 "2015-10-26T10:35:14Z")

</div>

@mrkschan Interesting idea. I actually never tried that. This will probably fail as the file output tries to create and rotate files which I don't think is possible for /dev/stdout. I would recommend to create a local file and tail it for debugging at the moment.

What is the error you get with the above?

---

<div class="post-metadata">

### Author: ![mrkschan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mrkschan/32/5386_2.png) [@mrkschan](https://discuss.elastic.co/u/mrkschan)
#### Post date: [October 26, 2015, 11:53am UTC](https://discuss.elastic.co/t/is-it-possible-to-write-to-dev-stdout-using-file-output/32935/3 "2015-10-26T11:53:45Z")

</div>

No error can be spotted actually... The beats output just disappear and I don't even get any info from -d '\*' debug selector. @ruflin

---

<div class="post-metadata">

### Author: ![monica](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/monica/32/3696_2.png) [@monica](https://discuss.elastic.co/u/monica)
#### Post date: [October 26, 2015, 12:23pm UTC](https://discuss.elastic.co/t/is-it-possible-to-write-to-dev-stdout-using-file-output/32935/4 "2015-10-26T12:23:19Z")

</div>

Yes, indeed. I get the same behavior. No warning is printed out. I created a bug in libbeat and it's targeted to be fixed for the next release 1.0.0-GA: [https://github.com/elastic/libbeat/issues/212](https://github.com/elastic/libbeat/issues/212)

---

<div class="post-metadata">

### Author: ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)
#### Post date: [October 26, 2015, 2:54pm UTC](https://discuss.elastic.co/t/is-it-possible-to-write-to-dev-stdout-using-file-output/32935/5 "2015-10-26T14:54:34Z")

</div>

@mrkschan is -d 'publish' ok for your purpose? I once used to create a stdout logger myself, but found -d 'publish' as well as good.

---

<div class="post-metadata">

### Author: ![mrkschan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mrkschan/32/5386_2.png) [@mrkschan](https://discuss.elastic.co/u/mrkschan)
#### Post date: [October 27, 2015, 2:59pm UTC](https://discuss.elastic.co/t/is-it-possible-to-write-to-dev-stdout-using-file-output/32935/6 "2015-10-27T14:59:12Z")

</div>

@steffens that is great! Though, why -d '\*' cannot catch this or do I miss something?

BTW, I'm thinking if stdout is an viable output option in libbeat. Consider the following cases:

1. libbeat is used in a custom beat that is required to send events offline (e.g. latency requirement, durability requirement, etc.), either file output or stdout will be used and later ship via filebeat for instance. If that beat is executed inside a Docker container, stdout would be a preferable option.
2. libbeat is used in a custom beat that is required to send outputs to stdout according to the ops team so that it can be integrated with syslog easily (there's some good reason behind this - [https://hynek.me/articles/taking-some-pain-out-of-python-logging/](https://hynek.me/articles/taking-some-pain-out-of-python-logging/)).
3. straight forward debug / development option.

Though I know that I make up these cases, libbeat as a library may not prevent a common output option - stdout.

---

<div class="post-metadata">

### Author: ![monica](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/monica/32/3696_2.png) [@monica](https://discuss.elastic.co/u/monica)
#### Post date: [October 27, 2015, 4:47pm UTC](https://discuss.elastic.co/t/is-it-possible-to-write-to-dev-stdout-using-file-output/32935/7 "2015-10-27T16:47:58Z")

</div>

I created a ticket in GitHub to add /dev/stdout as file output: [https://github.com/elastic/libbeat/issues/218](https://github.com/elastic/libbeat/issues/218)

---

<div class="post-metadata">

### Author: ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)
#### Post date: [October 28, 2015, 12:18pm UTC](https://discuss.elastic.co/t/is-it-possible-to-write-to-dev-stdout-using-file-output/32935/8 "2015-10-28T12:18:52Z")

</div>

we found a bug in -d '_' : [https://github.com/elastic/libbeat/pull/226](https://github.com/elastic/libbeat/pull/226)  
-d '_' should work in next releases

---

<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: [July 5, 2017, 9:58pm UTC](https://discuss.elastic.co/t/is-it-possible-to-write-to-dev-stdout-using-file-output/32935/9 "2017-07-05T21:58:32Z")

</div>


