4
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

logstashのログが/var/log/messagesにも出力されてしまうのを抑止する

Posted at

logstashをインストールして、起動すると/var/log/logstash/logstash-plain.logに出力される内容が、/var/log/messagesにも出力されてしまう。これを抑止する一つの方法として、systemctlで使うサービスファイルを編集する。StandardOutputとStandardErrorをそれぞれnullに設定する。行がなければ追加する。

## これはlogstashの標準出力やエラー出力をjournaldが全て横取りして、/var/log/messagesに書いてしまう事が原因と考えられる。

/etc/rsyslogd.confは特に変更する必要はない。

/etc/systemd/system/logstash.service
[Unit]
Description=logstash

[Service]
Type=simple
User=logstash
Group=logstash
# Load env vars from /etc/default/ and /etc/sysconfig/ if they exist.
# Prefixing the path with '-' makes it try to load, but if the file doesn't
# exist, it continues onward.
EnvironmentFile=-/etc/default/logstash
EnvironmentFile=-/etc/sysconfig/logstash
ExecStart=/usr/share/logstash/bin/logstash "--path.settings" "/etc/logstash"
Restart=always
WorkingDirectory=/
Nice=19
LimitNOFILE=16384
StandardOutput=null
StandardError=null

[Install]
WantedBy=multi-user.target
4
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?