# How to redirect the log message to a file?

**URL:** <https://discuss.elastic.co/t/how-to-redirect-the-log-message-to-a-file/37062>\
**Category:** Elasticsearch\
**Created:** [December 13, 2015, 2:37pm UTC](https://discuss.elastic.co/t/how-to-redirect-the-log-message-to-a-file/37062 "2015-12-13T14:37:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![miracle24](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@miracle24](https://discuss.elastic.co/u/miracle24)\
**Post date:** [December 13, 2015, 2:37pm UTC](https://discuss.elastic.co/t/how-to-redirect-the-log-message-to-a-file/37062/1 "2015-12-13T14:37:04Z")

</div>

I use ES2.1.0.0 and I have a script. when I run the scrip,it will show the log message,like  
`[2015-12-13 14:21:35,986][INFO][index.shard] [Dagger] [world][2] updating refresh_interval from [16.6m] to [-1000] [2015-12-13 14:21:35,987][INFO][index.shard] [Dagger] [world][3] updating refresh_interval from [16.6m] to [-1000] [2015-12-13 14:21:35,987][INFO][index.shard] [Dagger] [world][1] updating refresh_interval from [16.6m] to [-1000] [2015-12-13 14:21:35,987][INFO][index.shard] [Dagger] [world][0] updating refresh_interval from [16.6m] to [-1000] [2015-12-13 14:21:35,987][INFO][index.shard] [Dagger] [world][4] updating refresh_interval from [16.6m] to [-1000]`  
And when I run the script in the background, and even when I redirect the message to some file, using command like  
`./test.sh > test.log 2>1&`,  
it happened, too. That makes me feel upset and confused. How can I solve this?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [December 13, 2015, 3:09pm UTC](https://discuss.elastic.co/t/how-to-redirect-the-log-message-to-a-file/37062/2 "2015-12-13T15:09:07Z")

</div>

May be -d ?

[https://www.elastic.co/guide/en/elasticsearch/reference/current/setup.html#setup-installation-daemon](https://www.elastic.co/guide/en/elasticsearch/reference/current/setup.html#setup-installation-daemon)

---

<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, 11:31pm UTC](https://discuss.elastic.co/t/how-to-redirect-the-log-message-to-a-file/37062/3 "2017-07-05T23:31:28Z")

</div>

Closed on July 5, 2017, 11:31pm UTC


