Automatic Log Cleanup

This section, which includes this guide, describes the features of OvenMediaEngine Enterprise available for subscription on AWS Marketplace.

OvenMediaEngine Enterprise on AWS continuously generates Log Files while the service is running. If logs accumulate, Disk usage may increase excessively. To prevent this in advance, OvenMediaEngine Enterprise provides the Automatic Log Cleanup feature.

Default Log Cleanup Policy

The default Automatic Log Cleanup policy applied to OvenMediaEngine Enterprise on AWS is as follows:

  • Retention (Days): Logs older than 90 days are automatically deleted.

  • Minimum Retention (Days): Logs from the most recent 1 day are always retained.

  • Size Limit (MB): If the total size exceeds 1GB (1024MB), the oldest files are deleted first to free up space.

  • Run Schedule: Automatic Log Cleanup is enabled by default and runs automatically every day at 03:00 (UTC).

This policy applies to the following logs:

Log Type
Directory
File Pattern
Description

OvenMediaEngine

/var/log/ovenmediaengine

ovenmediaengine.log.*

OME Core Engine Log (Rotated)

Web Console

/var/log/ovenmediaengine/ovenstudio

oven-studio_*.log

Web Console Service Log

OvenMediaEngine Delivery

/var/log/ovenmediaengine/ovenmediaengine-delivery

delivery-daemon.log.*

Recording Delivery System Log

OvenMediaEngine Monitoring

/var/log/ovenmediaengine

events.log.*

OME Monitoring Event Log

Changing the Log Cleanup Policy

If you need to adjust the policy (such as retention period or size limit) for your environment, follow the steps below.

1

Edit the Log Cleanup Script

  1. Connect to your instance via SSH (following the EC2 connection official guidearrow-up-right), then open the script with the command below:

sudo vi /opt/omee-log-cleanup.sh
2

Update the Policy using Variables

  1. The variables defined at the top of the script are used as the default values:

# Configuration (Adjust according to your environment)
RETENTION_DAYS=90    # Max retention period (days)
MIN_RETENTION_DAYS=1    # Min retention period (days) - Safety guard for size limit
MAX_TOTAL_SIZE_MB=1024    # Max allowed size (MB) - e.g., 1GB
Value
Input Range
Description

RETENTION_DAYS

0~

  • Default: 90

Sets the maximum retention period (days) for stored logs.

MIN_RETENTION_DAYS

0~

  • Default: 1

Sets the minimum retention period (days) for stored logs.

  • This is a safety guard to prevent files within this period from being deleted, even when the size limit is exceeded.

MAX_TOTAL_SIZE_MB

0~

  • Default: 1024

Sets the maximum allowed storage size (MB) for retained logs.

  1. If you modify these variables, the new values will be applied to all cleanup_logs entries in the script.

# 1. OvenMediaEngine Core Logs
cleanup_logs "/var/log/ovenmediaengine" "ovenmediaengine.log.*" $RETENTION_DAYS $MIN_RETENTION_DAYS $MAX_TOTAL_SIZE_MB

# 2. OvenStudio Logs
cleanup_logs "/var/log/ovenmediaengine/ovenstudio" "oven-studio_*.log" $RETENTION_DAYS $MIN_RETENTION_DAYS $MAX_TOTAL_SIZE_MB

# 3. Delivery Daemon Logs
cleanup_logs "/var/log/ovenmediaengine/ovenmediaengine-delivery" "delivery-daemon.log.*" $RETENTION_DAYS $MIN_RETENTION_DAYS $MAX_TOTAL_SIZE_MB

# 4. Events Logs
cleanup_logs "/var/log/ovenmediaengine" "events.log.*" $RETENTION_DAYS $MIN_RETENTION_DAYS $MAX_TOTAL_SIZE_MB
3

Customize Policy per Log Type (Optional)

  • If you want different policies for different log files, edit the cleanup_logs calls near the bottom of the script.

# 1. OvenMediaEngine Core Logs
cleanup_logs "/var/log/ovenmediaengine" "ovenmediaengine.log.*" $RETENTION_DAYS $MIN_RETENTION_DAYS $MAX_TOTAL_SIZE_MB

# 2. OvenStudio Logs
cleanup_logs "/var/log/ovenmediaengine/ovenstudio" "oven-studio_*.log" $RETENTION_DAYS $MIN_RETENTION_DAYS $MAX_TOTAL_SIZE_MB

# 3. Delivery Daemon Logs
cleanup_logs "/var/log/ovenmediaengine/ovenmediaengine-delivery" "delivery-daemon.log.*" $RETENTION_DAYS $MIN_RETENTION_DAYS $MAX_TOTAL_SIZE_MB

# 4. Events Logs
cleanup_logs "/var/log/ovenmediaengine" "events.log.*" $RETENTION_DAYS $MIN_RETENTION_DAYS $MAX_TOTAL_SIZE_MB

Syntax

cleanup_logs "<log_directory>" "<file_pattern>" retention_days min_retention_days max_total_size_mb

Example

  • Main Log (ovenmediaengine.log.*) is typically more important, so this example keeps logs for 7–180 days and allows up to 5GB of total storage.

cleanup_logs "/var/log/ovenmediaengine" "ovenmediaengine.log.*" 180 7 5120
  • Event Log (events.log.*) is relatively less critical, so this example keeps logs for 1–30 days and allows up to 500MB of total storage.

cleanup_logs "/var/log/ovenmediaengine" "events.log.*" 30 1 500
4

Save the Log Cleanup Script

  1. After editing the script, save the file to apply the changes immediately. There is no need to restart the instance, restart OvenMediaEngine (service), or re-register the crontab.

Last updated