ハマログ

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

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日


関連記事

Amazon Linux2でEBSボリュームを拡張する

EC2で運用中の本番サーバーのEBSディスク容量が標準の8GBになっていたので、…

Auroraインスタンスに外部から直接アクセスする

Auroraのインスタンスに外部から直接接続する設定です。 AWSコンソールでR…

Amazon EventBridgeスケジューラーの実行ログを確認する

Amazon EventBridge スケジューラでEC2インスタンスの自動停止…


← 前の投稿

次の投稿 →