ハマログ

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

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日


関連記事

AWS ChatbotでSlackに通知する

AWSからの通知をSlackに連携する場合、いくつかの選択肢がありますが、AWS…

クラウドの設定ミス対策ガイドブック

クラウドの設定 AWSやGCPをはじめとしたクラウドサービスを度々利用するがやは…

AWS CloudFormationの削除保護について備忘

先日に引き続きAWS CloudFormationネタでごんす。 AWSコンソー…


← 前の投稿

次の投稿 →