2

I need to rotate my Resque logs on AWS Elastic Beanstalk on AMI Linux 2 with Ruby. My Puma and Nginx logs rotate properly. I've added the following config below, but the logs are not getting rotated.

.ebextensions/03_publish-logs.config

files:
 "/opt/elasticbeanstalk/tasks/publishlogs.d/resque.conf" :
  mode: "000755"
  owner: root
  group: root
  content: |
    /var/log/resque/rotated/*

.ebextensions/04_rotate-logs.config

files:
 "/etc/logrotate.elasticbeanstalk.hourly/logrotate.elasticbeanstalk.resque.conf" :
  mode: "000755"
  owner: root
  group: root
  content: |
   /var/log/resque/* {
    su root root
    size 10M
    rotate 5
    missingok
    compress
    notifempty
    copytruncate
    dateext
    dateformat %s
    olddir /var/log/resque/rotated
   }

I'm following this documentation: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.logging.html#health-logs-logrotate

fnllc
  • 3,047
  • 4
  • 25
  • 42

1 Answers1

0

You forgot to add this config to logrotate.

Add this code to .ebextensions:

files:
  "/etc/cron.hourly/cron.logrotate.elasticbeanstalk.resque.conf" :
    mode: "000755"
    owner: root
    group: root
    content: |
      #!/bin/sh
      test -x /usr/sbin/logrotate || exit 0
      /usr/sbin/logrotate /etc/logrotate.elasticbeanstalk.hourly/logrotate.elasticbeanstalk.resque.conf