ハマログ

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

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

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 ロギング画面でログを確認できるようになりました。
ApacheGCEGCPGooglehttpdLaravellogLoggingmonitoringVMモニタリングロギングログ転送

  kaneko tomo   2022年1月24日


関連記事

メンテナンス画面リダイレクト設定(Apache 2.2~2.4)

apacheの2.2 と 2.4 で設定書き方変わりますよね。 以下、メンテナン…

Amazon EventBridgeでAuroraを自動停止する

Auroraクラスターは手動で停止できるのですが、AWSの仕様により7日後に自動…

CloudWatchでプロセス監視をする

タイトル通りでございます。 CloudWatchでプロセス監視の設定をする作業を…


← 前の投稿

次の投稿 →