Operations

Log Rotation

A log rotation script is packaged within the Coreapp and Webapp containers.

Webapp

The log rotation script in the Webapp container:

  • Uses the logrotate utility.
  • Keeps the last 30 files of web, access, and error logs.
  • Rotates only if the size is greater than 20MB.
  • Compresses rotated log files.
  • Archives old log files to /var/log/whatsapp/archive.

Coreapp

The log rotation script in the Coreapp container:

  • Uses an in-house script.
  • Keeps the last 30 files.
  • Rotates automatically if size is greater than 15MB.
  • Compresses rotated log files.
  • Archives old log files to /var/log/whatsapp/archive.

In the Coreapp, a new log file is only created when the size exceeds 15MB per log file. The old log files are not removed automatically.

Cleanup Script Recommendation

WhatsApp recommends you periodically (i.e., daily) execute the cleanup script below to perform log rotation on all Webapp, Coreapp and Master (in the case of a Multiconnect setup) containers. It's best to configure a cronjob on your host to perform on all running WhatsApp Business API containers and be executed during off-peak hours. Invoking the cleanup script periodically will keep the disk space consumed by log files under control.

docker exec your-container-name /opt/whatsapp/bin/cleanup.sh