Logs

Document Navigation

Logs

Introduction

Cmfive supports two different types of log targets to best suit your needs.

  • The AWS Target provides a more reliable solution with the option to specify a retention period (in days).
  • The File Target is enabled by default and requires no further setup.

AWS Target

  1. Add the following entries into the config.php file in the root directory of your Cmfive project.
     Config::set("admin.logging", [
         "target"           => "aws",
         "retention_period" => RETENTION_PERIOD,
         "cloudwatch"       => [
             "group_name"      => "GROUP_NAME",
             "stream_name_app" => "APP_NAME",
             "region"          => "CLOUDWATCH_REGION",
             "version"         => "latest",
         ]
     ]);
    
  2. If you’re developing on Cmfive locally, also add the following. Note, when system.environment is set to production AWS IAM Roles must be used to authenticate with AWS as this is best practice for security.
     Config::set("admin.logging.cloudwatch.credentials", [
         "key"    => "IAM_KEY",
         "secret" => "IAM_SECRET",
     ]);
    
     Config::set("system.environment", "development");
    
  3. Replace RETENTION_PERIOD, GROUP_NAME, APP_NAME, CLOUDWATCH_REGION with their respective values as well as IAM_KEY and IAM_SECRET if system.environment is set to development.

  4. Make sure to clear your config cache to apply your changes.