Skip to content

Magento Maintenance and Upgrades — Updates, Patches and Monitoring

DodaTech Updated 2026-06-27 7 min read

In this tutorial, you'll learn how to maintain a Magento store through version upgrades, security patches, performance monitoring with New Relic, log management, and routine maintenance routines.

What You'll Learn

  • How to upgrade Magento to a new minor or major version
  • How to apply individual quality and security patches
  • How to monitor Magento with New Relic APM
  • How to manage and rotate log files
  • How to set up routine maintenance schedules

Why It Matters

Magento requires ongoing maintenance. Security patches must be applied monthly, logs must be monitored for errors, and database tables need cleanup to prevent performance degradation. Neglecting maintenance leads to security vulnerabilities, slow performance, and eventual site failure.

Real-World Use

A Magento store running 2.4.4 needs to upgrade to 2.4.6 for PHP 8.2 support and security improvements. The team backs up the database and files, tests the upgrade on staging, applies the update via Composer, runs setup:upgrade, reindexes, tests all critical flows, and deploys to production. The entire process takes 4 hours including testing.

Learning Path

flowchart LR
    A[Deployment] --> B[Maintenance & Upgrades]
    B --> C[Professional Magento Developer]
    style B fill:#3b82f6,color:#fff

Upgrade Magento Version

Step 1: Check Compatibility

Before upgrading, verify that your extensions and custom code are compatible:

# Check available versions
composer show --available magento/product-community-edition

# Check extension compatibility
composer show vendor/your-extension

Step 2: Backup

# Backup database
mysqldump -u root -p magento_db > backup_$(date +%Y%m%d).sql

# Backup files
tar -czf backup_$(date +%Y%m%d).tar.gz /var/www/magento/

Step 3: Enable Maintenance Mode

bin/magento maintenance:enable

Step 4: Update Composer

# Update Magento to specific version
composer require magento/product-community-edition=2.4.6 --no-update

# Update all dependencies
composer update magento/product-community-edition --with-dependencies

Step 5: Run Setup Upgrade

bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy -f
bin/magento cache:flush

Step 6: Test and Go Live

# Reindex
bin/magento indexer:reindex

# Disable maintenance
bin/magento maintenance:disable

Magento Quality Patches

Adobe Quality Patches provides individual fixes without a full version upgrade.

Install Quality Patches Tool

composer require magento/quality-patches
bin/magento setup:upgrade

List Available Patches

bin/magento quality-patches:list

Output shows all available patches grouped by component:

Available Patches:
╔════════════════════════════════════════════════════════════╗
║ ID                  │ Title                               ║
╠════════════════════════════════════════════════════════════╣
║ MDVA-12345          │ Fix for product price display issue ║
║ MDVA-23456          │ Fix for cart price rule             ║
║ MDVA-34567          │ Fix for customer grid filter        ║
╚════════════════════════════════════════════════════════════╝

Apply a Single Patch

# Apply specific patch
bin/magento quality-patches:apply MDVA-12345

# Verify applied patches
bin/magento quality-patches:status

Upgrade from 2.3.x to 2.4.x

Upgrading from Magento 2.3.x to 2.4.x involves significant changes:

Component 2.3.x 2.4.x
PHP 7.3 or 7.4 8.1 or 8.2
MySQL 5.7 8.0
Elasticsearch Optional Required
MySQL search Available Removed
B2B modules Separate install Bundled in Commerce

Migration Steps

  1. Upgrade PHP to 8.1
  2. Upgrade MySQL to 8.0
  3. Install Elasticsearch or OpenSearch
  4. Update Composer to require 2.4.x
  5. Remove obsolete modules (Magento___Search, etc.)
  6. Run setup:upgrade
  7. Enable Elasticsearch in configuration

Monitoring with New Relic

New Relic APM provides detailed performance monitoring for Magento.

Install New Relic Agent

# Install the PHP agent
sudo apt-get install newrelic-php5

# Configure
sudo newrelic-install install

Configure New Relic for Magento

Add to php.ini:

newrelic.appname = "Magento Production"
newrelic.distributed_tracing_enabled = true
newrelic.transaction_tracer.detail = 1

Key Metrics to Monitor

  • Apdex score — user satisfaction (target > 0.94)
  • Transaction time — average response time (target < 500ms)
  • Slow transactions — identify slowest Magento actions
  • Database queries — query count and duration
  • External calls — API and service call times

Set up alerts for:

  • Transaction time exceeding 2 seconds
  • Error rate exceeding 1%
  • Apdex dropping below 0.85

Log Management

Magento Log Locations

Log File Location Contents
System log var/log/system.log General system messages
Exception log var/log/exception.log PHP exceptions and errors
Debug log var/log/debug.log Debug-level messages (enabled in developer mode)
Cron log var/log/cron.log Cron job execution results
Payment logs var/log/payment-*.log Payment gateway transactions

Monitor Logs in Real Time

# Watch system log
tail -f var/log/system.log

# Watch for errors
tail -f var/log/exception.log | grep -i error

# Search for specific terms
grep "SQLSTATE" var/log/exception.log

Log Rotation

Configure logrotate to prevent logs from consuming disk space:

# /etc/logrotate.d/magento
/var/www/magento/var/log/*.log {
    daily
    rotate 30
    compress
    delaycompress
    missingok
    notifempty
    create 644 www-data www-data
    sharedscripts
    postrotate
        [ -f /var/run/php/php8.2-fpm.pid ] && kill -USR1 $(cat /var/run/php/php8.2-fpm.pid)
    endscript
}

Routine Maintenance Schedule

Daily Tasks

  • Check for failed payments in sales reports
  • Review var/log/exception.log for new errors
  • Verify Cron Jobs ran successfully
  • Check stock alerts for out-of-stock items

Weekly Tasks

  • Review export and import history
  • Check sales reports for anomalies
  • Monitor disk space on the server
  • Verify backup completion

Monthly Tasks

  • Apply available security patches
  • Run database log cleanup
  • Review performance metrics
  • Check New Relic for slow transactions
  • Review extension updates
  • Clean up old admin sessions

Database Log Cleanup

Magento accumulates log data that slows the database. Clean it monthly:

bin/magento maintenance:enable
bin/magento cron:run --group=cleanup
bin/magento maintenance:disable

Manual cleanup for specific tables:

-- Clean old order data
DELETE FROM sales_order WHERE created_at < DATE_SUB(NOW(), INTERVAL 6 MONTH);

-- Clean old log data
TRUNCATE TABLE log_customer;
TRUNCATE TABLE log_visitor;
TRUNCATE TABLE log_visitor_info;
TRUNCATE TABLE log_url;
TRUNCATE TABLE log_url_info;
TRUNCATE TABLE report_event;

Backup Before Upgrade

Always create a full backup before any upgrade:

#!/bin/bash
# Full backup script
BACKUP_DIR="/backups/$(date +%Y%m%d_%H%M%S)"
mkdir -p "$BACKUP_DIR"

# Database backup
mysqldump -u root -p magento_db > "$BACKUP_DIR/db.sql"

# File backup
tar -czf "$BACKUP_DIR/files.tar.gz" \
    --exclude="var/cache" \
    --exclude="var/session" \
    --exclude="var/page_cache" \
    /var/www/magento/

echo "Backup complete: $BACKUP_DIR"

Common Mistakes

  • Upgrading Magento without checking extension compatibility first, causing fatal errors after the upgrade
  • Skipping the database backup before an upgrade, losing the ability to roll back if something goes wrong
  • Applying quality patches without running setup:upgrade, so the patch changes do not take effect
  • Ignoring the New Relic slow transaction log, missing performance issues that affect customers daily
  • Letting log files grow uncontrolled, consuming all disk space and causing the site to crash

Practice Questions

  1. What commands are required after updating the Magento version via Composer?
  2. Why is it important to test an upgrade on a staging environment before production?
  3. How do you apply a single quality patch without upgrading the entire Magento version?

Challenge: Create a complete maintenance automation script that performs monthly tasks: backs up the database, cleans log tables, applies any available quality patches, runs reindex, and sends a summary report via email.

FAQ

{{< faq "How often should I upgrade Magento?" }} Adobe releases a new minor version every 6-12 months and security patches monthly. Plan for minor version upgrades every 12-18 months and security patches within 48 hours of release. {{< /faq >}}

What is the difference between a quality patch and a version upgrade?

A quality patch fixes a specific issue without changing the Magento version number. A version upgrade moves to a new minor or major release with new features, deprecations, and all accumulated fixes.

How do I monitor Magento performance?

Use New Relic APM for transaction monitoring, server metrics, and error tracking. Complement with Varnish logs for cache hit rate and MySQL slow query log for database performance.

Do I need to reindex after a version upgrade?

Yes. Always run bin/magento indexer:reindex after a version upgrade to ensure all index data is rebuilt with the new software version.

Mini Project

Create a complete maintenance dashboard script that checks all critical aspects of a Magento store: current version vs latest available version, last upgrade date, applied quality patches, log file sizes, disk space, database table sizes, New Relic Apdex score, and Varnish hit rate. Output a green/yellow/red status for each check and email the report to the team.

What's Next

Congratulations on completing the Magento tutorial series. You now have a solid foundation in Magento from installation through maintenance. Explore advanced topics like PHP module development, custom MySQL optimization, and headless commerce with PWA Studio.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro