ハマログ

株式会社イーツー・インフォの社員ブログ

Google Cloud Ops エージェントでLaravelログをCloud Loggingに転送する

+3
Ops エージェントでVMインスタンス上のログファイルをクラウド側に送る設定をしました。

Opsエージェントのインストール

ログ転送設定

/etc/google-cloud-ops-agent/config.yamlを編集します。
logging:
  receivers:
    laravel_log:
      type: files
      include_paths:
        - /var/www/path_to_laravel/storage/logs/*.log
  service:
    pipelines:
      custom_pipeline:
        receivers: [laravel_log]
再起動させて反映
systemctl restart google-cloud-ops-agent
ステータス確認
systemctl status google-cloud-ops-agent
Apacheのログも送るように設定
logging:
  receivers:
    laravel_log:
      type: files
      include_paths:
        - /var/www/path_to_laravel/storage/logs/*.log
    httpd_access_log:
      type: files
      include_paths:
        - /var/log/httpd/access_log
    httpd_error_log:
      type: files
      include_paths:
        - /var/log/httpd/error_log
  service:
    pipelines:
      custom_pipeline:
        receivers: [laravel_log, httpd_access_log, httpd_error_log]
Cloud ロギング画面でログを確認できるようになりました。
+3
ApacheGCEGCPGooglehttpdLaravellogLoggingmonitoringVMモニタリングロギングログ転送

  kaneko tomo   2022年1月24日


関連記事

Google Cloud ArmorでCloud Shellを使ったルールのコピー
+11

Google Cloud Armorで設定したルールを別の環境にも同様に適応した…

+11
Ubuntuの*** System restart required ***の内容を確認する
+5

Ubuntuの起動時に*** System restart required *…

+5
WinSCPでS3バケットに接続する
+3

AWS WAFのログをKinesis経由でS3に保存しているのですが、バッファで…

+3

← 前の投稿

次の投稿 →