# How to avoid outputting filebeat logs to /var/log/messages

**URL:** <https://discuss.elastic.co/t/how-to-avoid-outputting-filebeat-logs-to-var-log-messages/272642>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [May 11, 2021, 7:51am UTC](https://discuss.elastic.co/t/how-to-avoid-outputting-filebeat-logs-to-var-log-messages/272642 "2021-05-11T07:51:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![its-ogawa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/its-ogawa/32/120829_2.png) [@its-ogawa](https://discuss.elastic.co/u/its-ogawa)\
**Post date:** [May 11, 2021, 7:51am UTC](https://discuss.elastic.co/t/how-to-avoid-outputting-filebeat-logs-to-var-log-messages/272642/1 "2021-05-11T07:51:46Z")

</div>

I do not want to output filebeat logs to /var/log/messages.  
So, I configured `to_syslog` and `Environment`, referring to the following article.

> [@Prevent from filebeat to logging to /var/messages](https://discuss.elastic.co/t/prevent-from-filebeat-to-logging-to-var-messages/223773):
>
> Hi , is there any way to prevent from filebeat logging to /var/messages ? , it logging and sends to logstash every beat example /var/log/messages Mar 16 15:27:19 solrc-stg1 filebeat[20876]: 2020-03-16T15:27:19.680+0200 INFO [monitoring] log/log.go:145 Non-zero metrics in the last 30s {"monitoring": {"metrics" ..... Thanks in advance.

However, they do not work.  
Can you please tell me how to do it correctly?

Here are the actual steps I took.

```auto
$ vi /etc/filebeat/filebeat.yml
logging: # <- add
  to_syslog: false # <- add

$systemctl edit filebeat.service
[Service] # <- add
Environment="BEAT_LOG_OPTS=" # <- add

$ systemctl daemon-reload
$ systemctl restart filebeat

```

---

<div class="post-metadata">

**Author:** ![its-ogawa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/its-ogawa/32/120829_2.png) [@its-ogawa](https://discuss.elastic.co/u/its-ogawa)\
**Post date:** [May 14, 2021, 1:33am UTC](https://discuss.elastic.co/t/how-to-avoid-outputting-filebeat-logs-to-var-log-messages/272642/2 "2021-05-14T01:33:18Z")

</div>

Can anyone give me some good ideas?

---

<div class="post-metadata">

**Author:** ![its-ogawa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/its-ogawa/32/120829_2.png) [@its-ogawa](https://discuss.elastic.co/u/its-ogawa)\
**Post date:** [May 17, 2021, 7:31am UTC](https://discuss.elastic.co/t/how-to-avoid-outputting-filebeat-logs-to-var-log-messages/272642/3 "2021-05-17T07:31:54Z")

</div>

Hmmm. I'm not sure, but the following statement worked for me.

```auto
$ vi /etc/filebeat/filebeat.yml
logging:
  level: info
  to_files: true
  to_syslog: false

```

```auto
$ systemctl restart filebeat

```

After the following log, the filebeat log will not appear in the syslog.

```auto
$ tail /var/log/messages | grep filebeat
... snip ...
May 17 15:37:46 MY_SERVER filebeat: 2021-05-17T15:37:46.062+0900#011INFO#011[monitoring]#011log/log.go:153#011Uptime: 267h59m3.387902897s
May 17 15:37:46 MY_SERVER filebeat: 2021-05-17T15:37:46.062+0900#011INFO#011[monitoring]#011log/log.go:130#011Stopping metrics logging.
May 17 15:37:46 MY_SERVER filebeat: 2021-05-17T15:37:46.062+0900#011INFO#011instance/beat.go:474#011filebeat stopped.
... snip ...

```

---

<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:** [June 14, 2021, 9:32am UTC](https://discuss.elastic.co/t/how-to-avoid-outputting-filebeat-logs-to-var-log-messages/272642/4 "2021-06-14T09:32:35Z")

</div>

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