ハマログ

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

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…

Google Apps Scriptで、Googleドキュメントのバックアップ

こんにちは、かねこです。 はじめに 弊社では、Googleドライブを利用して、一…

GCP(Google Cloud Platform)で環境構築するのに困った話

PHP屋で長いことやってきて『手順書と首っ引きならどうにかLinux設定してフレ…


← 前の投稿

次の投稿 →