Magento 2.1.18 is the final 2.1.x release. After June 2019, Magento 2.1.x will no longer receive security patches, quality fixes, or documentation updates.
To maintain your site's performance, security, and PCI compliance, upgrade to the latest version of Magento.

Set up notifications

By default, Magento Commerce Cloud writes build and deploy actions to the app/var/log/cloud.log file inside the Magento root application directory. Optionally, you can send logs to a messaging system, such as Slack and email, to receive real-time notifications.

For example, you could send a Slack message to alert a group of people when a deployment fails, and prompt an investigation into what went wrong.

Plan notifications

Before you configure notifications, consider the following:

  • What kind of notifications do you want to receive (Slack messages, email, both)?
  • How much detail do you want to see in the logs?
  • Where do you want to set up notifications (Integration, Staging, Production)?

For example, during initial development you may prefer email notifications that show detailed logs about your Integration environment to help you debug issues before deploying to the Staging environment. When you are ready to deploy to the Staging or Production environment, you may prefer a Slack message that contains less detailed information.

The configuration file used to set up notifications is at the root of your project directory, so it applies when you push changes to any environment. If you want to customize notifications per environment, you must modify the configuration file before pushing it to that environment.

Configure notifications

To configure notifications:

  1. Open a terminal and checkout a branch in your local environment.
  2. In the .magento.env.yaml file in your project root, add your messaging system settings, including preferred notification Log levels.

    For example, to configure both Slack and email configurations, use the following:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    
    log:
      slack:
        token: "<your-slack-token>"
        channel: "<your-slack-channel>"
        username: "SlackHandler"
        min_level: "info"
      email:
        to: <your-email>
        from: <your-email>
        subject: "Log notification from Magento Cloud"
        min_level: "notice"
    

    Magento Commerce Cloud only sends emails during the deployment phase.

  3. Commit and push your changes to the remote server.

    1
    
     git -A && git commit -m "Configure build/deploy notifications"
    
    1
    
     git push origin <branch-name>
    

Example Slack configuration

The following example shows a Slack-only configuration:

1
2
3
4
5
6
log:
  slack:
    token: "<your-slack-token>"
    channel: "<your-slack-channel>"
    username: "SlackHandler"
    min_level: "info"
  • token—Your Slack user token. Your user token authorizes Magento Commerce Cloud to send messages.
  • channel—Name of the Slack channel Magento Commerce Cloud sends notifications.
  • username—Username Magento Commerce Cloud uses to send notification messages in Slack.
  • min_level—Minimum log level for notification messages. We recommend using info.

Example email configuration

The following example shows an email-only configuration:

Magento Commerce Cloud only sends emails during the deployment phase.

1
2
3
4
5
6
log:
  email:
    to: <your-email>
    from: <your-email>
    subject: "Log notification from Magento Cloud"
    min_level: "notice"
  • to—Email address Magento Commerce Cloud sends notification messages.
  • from—Email address for sending notification messages to recipients.
  • subject—Description of the email.
  • min_level—Minimum log level for notification messages. We recommend using notice or warning.
Updated