LoginSignup
0
1

More than 3 years have passed since last update.

New Relic メモ 〜Logs(Apache Log)〜

Posted at

はじめに

  • 前回は、Apache Integrationを設定した
  • ただ、Apacheのログに書かれているような内容は取れず、あくまでmod_statusで取れるような内容のみだった
  • なので、ログはLogsで取り込みをすることに

事前確認

  • OSの対応バージョンを確認する
  • Infrastructure Agentのバージョンを確認する(2020/9/1時点で1.11.4以上であること)
# rpm -qa | grep newrelic
newrelic-infra-1.12.2-1.el7.x86_64

Logsの設定

New RelicのLogsの画面から設定ウィザードを立ち上げる。Agentの種類が選べるので、既にインストール済みのNew Relic Infrastructure Agentをクリック

1875A135-C92D-4C87-8BF7-018C86021395.jpeg

手順が上がってくるので3. Configure your log sources and other parameters in the logging.d directory.から実施する。まず、サンプルの設定ファイルの所在を確認。

# ls -ltr /etc/newrelic-infra/logging.d/
合計 20
-rw-r--r--. 1 root root 1097  8月  7 23:18 tcp.yml.example
-rw-r--r--. 1 root root  930  8月  7 23:18 systemd.yml.example
-rw-r--r--. 1 root root 2762  8月  7 23:18 syslog.yml.example
-rw-r--r--. 1 root root 1173  8月  7 23:18 fluentbit.yml.example
-rw-r--r--. 1 root root 1664  8月  7 23:18 file.yml.example

色々パターンが提供されているものの、まずは転送することを優先。以下のファイルを作成する。

apache_access
logs:
  - name: "test_log"
    file: /var/log/httpd/ssl_request_log

Infrastructure Agentを再起動する

# systemclt restart newrelic-infra

New Relic Logsの画面を確認すると、ログが転送できていることが確認できる。

91C916C2-622C-4B22-BC73-3600A201FD43.jpeg

Logsでやりたいこと

  • 送信元IPやUser-Agentの統計を取ったり
  • URIごとのレスポンスを計測したり(静的コンテンツ含む)
  • そもそものアクセス数のタイムチャート取ったり

これらを作るにあたって、Queryを記載していくのだが、そもそものParsingがどうなっているかが不明。

Parsing

メニューがあったので、覗き見。

E4E4AADD-A0C9-4610-AB00-62D472CCC33F.jpeg

Grok filter形式で記述することで、簡単にエイリアス張れそう。よかったよかった。

4ED7C583-1D43-4BF2-9846-E24CD36E81FC.jpeg

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