LoginSignup
3
0

More than 1 year has passed since last update.

NewRelic Infrastructure Agentで収集するログにカスタム属性を追加する

Last updated at Posted at 2022-12-21

前提

NewRelic Infrastructureエージェントがインストールされている
newrelic-infraコマンドが利用可能である)

/etc/newrelic-infra/logging.d/logging.ymlを編集

  - name: newrelic-cli.log
    file: /root/.newrelic/newrelic-cli.log
    attributes:
      newrelic-cli: true
      logtype: newrelic-cli
      tag: test

fileにはNewRelicへ転送するログファイルのパスを記述する。

attributekey: valueといった形式で任意のカスタム属性を追加する。
(今回は"tag"というkeyに対して、"test"というvalueを設定した)

ファイルの変更内容を保存すれば、即時反映される。

NewRelicで確認

Logsから確認

key: "value"のような形式で対象のログを検索する
スクリーンショット 2022-12-21 20.04.04.png

適当にログの詳細を確認する
image.png

カスタム属性のtag: testが反映されている。


ログに対してカスタム属性を付けることによって、担当チームごとに分けてログの調査を行うなどといった使い方ができそう。

参考

3
0
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
3
0