Cloud 8.01

Locate and Use Logs

Understanding log locations, system service logs, Magento logs, and Starter vs Pro differences.

Exam Critical: Understanding log file locations, especially differences between Starter and Pro, is ESSENTIAL for the exam!

Locate and Use Logs

mindmap root((Cloud Logs)) System Service Logs var log directory access log app log error log php access log Deployment Logs deploy log post deploy log cron log Magento Logs app var log exception log system log debug log Starter vs Pro Starter var log Pro platform path Three deploy nodes

Log File Locations Overview

Three Main Log Categories

System Service Logs

/var/log/*
Web server, PHP-FPM, services

Deployment Logs

/var/log/*
Deploy, post-deploy, cron

Magento Application Logs

/app/var/log/*
Exception, system, debug

System Service Logs (/var/log/)

Critical Service Log Files

1. /var/log/access.log

Purpose:

Stores, in JSON format, all visits to the website and assets.

Contains:
  • HTTP requests
  • Response codes
  • Request timing
  • Client IP addresses
  • User agents
  • Asset requests (CSS, JS, images)
Use Case:

Traffic analysis, debugging 404s, performance monitoring, identifying bot traffic.

2. /var/log/app.log

Purpose:

Application service-related events (related to PHP-FPM).

Contains:
  • PHP-FPM errors and warnings
  • Application startup events
  • Service configuration issues
  • New Relic configuration errors
  • PHP process events
Example:

If New Relic is not properly configured, those errors will be displayed here (because PHP-FPM pushed events up to New Relic).

Use Case:

Debugging PHP service issues, monitoring application health, New Relic troubleshooting.

3. /var/log/cron.log

Purpose:

Logs the cron:run execution and its results.

Contains:
  • Cron job execution times
  • Job success/failure status
  • Individual job output
  • Cron schedule information
  • Job errors and exceptions
Use Case:

Debugging cron jobs, verifying scheduled task execution, troubleshooting indexers and cache clean jobs.

4. /var/log/deploy.log

Purpose:

The results from the deploy process.

Contains:
  • Build phase output
  • Deploy phase output
  • Static content deployment
  • Database upgrades
  • Configuration changes
  • Deployment errors
Important Note:

This does NOT display in the Project Web Interface because Cloud could be deploying to multiple environments (Pro).

On Pro projects, this log file will be in a platform directory.

5. /var/log/error.log

Purpose:

Contains web server errors.

Contains:
  • Nginx/web server errors
  • 502/503 gateway errors
  • Permission denied errors
  • File not found errors
  • Configuration errors
Critical Pro Note:

For Pro projects, you need to check this file on ALL THREE DEPLOY NODES.

6. /var/log/php.access.log

Purpose:

Contains PHP-FPM renders (their time, size, response code, etc.).

Contains:
  • PHP script execution time
  • Memory usage
  • Response codes
  • Request URI
  • Script path
Use Case:

Performance analysis, identifying slow PHP scripts, memory leak detection.

7. /var/log/post-deploy.log

Purpose:

Logs for the post-deploy hook.

Contains:
  • Post-deploy script output
  • Cache warming results
  • Cache flush operations
  • Post-deploy hook errors
Important Note:

These logs ARE viewable in the Project Web Interface.

Magento Application Logs (/app/var/log/)

Typical Magento Log Files

/app/var/log/
Log File Purpose Contains
exception.log PHP exceptions and errors Stack traces, exception messages, fatal errors
system.log General Magento system logs Info, warnings, errors from Magento modules
debug.log Debug messages Custom debug output, variable dumps
support_report.log Support reporting System information for support tickets
payment.log Payment gateway logs Payment transaction details, API calls

Accessing Magento Logs

magento-cloud ssh
cd /app/var/log
tail -f exception.log
tail -f system.log

Starter vs Pro: Key Differences

Critical Location Differences

The Big Difference

Other than the log file names (it's a good idea to understand what is in each log file), the big difference between Starter and Pro is that the service logs (like app.log) are stored in:

Starter & Integration Environments:
/var/log/app.log
/var/log/access.log
/var/log/error.log
/var/log/cron.log
/var/log/deploy.log
/var/log/php.access.log
/var/log/post-deploy.log
Pro Environments:
/var/log/platform/.../app.log
/var/log/platform/.../access.log
/var/log/platform/.../error.log
/var/log/platform/.../cron.log
/var/log/platform/.../deploy.log
/var/log/platform/.../php.access.log
/var/log/platform/.../post-deploy.log

Pro Platform Directory Structure

On Pro environments, service logs are stored in subdirectories under /var/log/platform/:

/var/log/platform/[PROJECT_ID]/[ENVIRONMENT_ID]/app.log
Example:
/var/log/platform/abc123xyz/master/app.log
/var/log/platform/abc123xyz/staging/app.log
/var/log/platform/abc123xyz/integration/app.log

Pro: Three Deploy Nodes

Multiple Nodes

Pro production environments have three deploy nodes for redundancy.

Why This Matters:
  • Error logs must be checked on ALL THREE NODES
  • An error might only appear on one node
  • Load balancer distributes traffic across nodes
  • Each node has its own /var/log/error.log
Checking All Nodes:
# SSH to each node
magento-cloud ssh --app web --worker 1
magento-cloud ssh --app web --worker 2
magento-cloud ssh --app web --worker 3

# Check error log on each
tail /var/log/error.log

Accessing Logs: Methods

How to View Logs

Method 1: SSH Access

Connect via SSH:
magento-cloud ssh -e integration
View Logs:
# Real-time log monitoring
tail -f /var/log/app.log
tail -f /app/var/log/exception.log

# View last 100 lines
tail -n 100 /var/log/error.log

# Search logs
grep "error" /var/log/app.log
grep -i "exception" /app/var/log/system.log

# Multiple logs simultaneously
tail -f /var/log/app.log /var/log/error.log

Method 2: Project Web Interface

Accessible Logs in UI:
  • post-deploy.log - ✅ Viewable in UI
  • Build and deploy output - ✅ Viewable in UI
  • deploy.log - ❌ NOT in UI (Pro has multiple environments)
  • Other service logs - ❌ SSH required
Viewing in UI:
  1. Navigate to environment
  2. Click Activity tab
  3. Click deployment
  4. View logs (build, deploy, post-deploy)

Method 3: Magento Cloud CLI

Log Command:
# View recent logs
magento-cloud log app
magento-cloud log access
magento-cloud log error

# Follow logs (real-time)
magento-cloud log app -f

# View logs for specific environment
magento-cloud log app -e staging

Common Log File Use Cases

When to Check Which Log

Debugging 500 Errors

  1. Check /var/log/error.log (web server errors)
  2. Check /app/var/log/exception.log (PHP exceptions)
  3. Check /var/log/app.log (PHP-FPM issues)

Deployment Failures

  1. Check /var/log/deploy.log (deploy phase)
  2. Check /var/log/post-deploy.log (post-deploy phase)
  3. Check Project Web Interface Activity tab

Cron Job Issues

  1. Check /var/log/cron.log (cron execution)
  2. Check /app/var/log/system.log (Magento cron output)
  3. Check /app/var/log/exception.log (cron exceptions)

Performance Problems

  1. Check /var/log/php.access.log (PHP execution time)
  2. Check /var/log/access.log (request volume)
  3. Enable New Relic for detailed analysis

New Relic Issues

  1. Check /var/log/app.log (New Relic config errors)
  2. Verify New Relic environment variables
  3. Check PHP-FPM service logs

Log File Comparison Table

Quick Reference

Log File Starter/Integration Pro Web UI Primary Use
access.log /var/log/ /var/log/platform/.../ HTTP requests (JSON)
app.log /var/log/ /var/log/platform/.../ PHP-FPM, New Relic
cron.log /var/log/ /var/log/platform/.../ Cron execution
deploy.log /var/log/ /var/log/platform/.../ ❌ (Pro) Deployment process
error.log /var/log/ /var/log/platform/.../ Web server errors
php.access.log /var/log/ /var/log/platform/.../ PHP performance
post-deploy.log /var/log/ /var/log/platform/.../ Post-deploy hook
exception.log /app/var/log/ PHP exceptions
system.log /app/var/log/ Magento system logs

Best Practices

Log Management

Do's

  • Check error.log on all three Pro nodes when debugging
  • Use tail -f for real-time log monitoring
  • grep logs to find specific errors quickly
  • Monitor cron.log to verify scheduled jobs run
  • Check deploy.log after failed deployments
  • Review access.log (JSON) for traffic patterns
  • Check app.log for New Relic configuration issues
  • Use Project Web Interface for post-deploy logs

Don'ts

  • Don't forget Pro logs are in /var/log/platform/.../
  • Don't check only one node on Pro (check all three!)
  • Don't expect deploy.log in Project Web Interface on Pro
  • Don't ignore cron.log when debugging indexers
  • Don't confuse /var/log/ (service) with /app/var/log/ (Magento)

Exam Tips

Key Points to Remember

  • access.log: JSON format, all website visits and assets
  • app.log: PHP-FPM events, New Relic errors
  • cron.log: cron:run execution and results
  • deploy.log: Deploy process, NOT in UI on Pro
  • error.log: Web server errors, check ALL THREE NODES on Pro
  • php.access.log: PHP-FPM renders (time, size, response code)
  • post-deploy.log: Post-deploy hook, VIEWABLE in Project Web UI
  • /app/var/log/: Typical Magento logs (exception.log, system.log)
  • Big difference: Pro service logs in /var/log/platform/.../
  • Starter/Integration: Service logs in /var/log/
  • Pro nodes: THREE deploy nodes, check error.log on all
  • Magento logs: Same location on both (/app/var/log/)