Logrotate prerotate script only fires for first log file, not all log files

logrotate

We're using a prerotate script to upload our server logs to an S3 bucket in AWS. Here's the logrotate script:

/var/log/nginx/*.log {
    daily
    missingok
    rotate 14
    compress
    delaycompress
    notifempty
    create 0644 www-data adm
    sharedscripts
    prerotate
            if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
                    run-parts /etc/logrotate.d/httpd-prerotate; \
            fi
            /usr/local/bin/upload_log_to_s3.sh $1
    endscript
    postrotate
            invoke-rc.d nginx rotate >/dev/null 2>&1
    endscript
}

The nginx directory has an ssl_access.log file and an access.log file (for https and http traffic respectively). We want both logs. When I try to run logrotate -f with the config file, though, I only see the first log, access.log, being processed. I want ssl_access.log to also be uploaded but the upload_log_to_s3.sh script only runs once and only gets the access.log path. I know the ssl_access.log file is being rotated because when I run logrotate with -v, it give me the following output, which is even more baffling:

empty log files are not rotated, old logs are removed
considering log /var/log/nginx/access.log
  log does not need rotating
considering log /var/log/nginx/error.log
  log does not need rotating
considering log /var/log/nginx/ssl_access.log
  log needs rotating

Everything I've read suggests the prerotate script runs once for each file captured by /var/log/nginx/*.log but this is not the behavior I'm seeing. Am I missing something?

Best Answer

So like an idiot, I just realized that I left in sharedscripts in the logrotate config, which is almost certainly the reason why the prerotate script only fires once. Not totally sure why access.log is the file that gets uploaded (according to the man page the first parameter changes to the glob, not the first found file?) but at least I know the core cause.

I'm leaving this answer here so others can profit from my mistake.