Commit ef987361 by John Jarvis

Merge pull request #1439 from edx/jarv/fix-log-sync

updates to syncing s3 logs and cron jobs
parents c0854a19 3f7c256c
...@@ -27,12 +27,12 @@ AWS_S3_LOGS_FROM_EMAIL: dummy@example.com ...@@ -27,12 +27,12 @@ AWS_S3_LOGS_FROM_EMAIL: dummy@example.com
# You should be overriding the environment and deployment vars # You should be overriding the environment and deployment vars
# Order of precedence is left to right for exclude and include options # Order of precedence is left to right for exclude and include options
AWS_S3_LOG_PATHS: AWS_S3_LOG_PATHS:
- bucket: "edx-{{ COMMON_ENVIRONMENT }}-{{ COMMON_DEPLOYMENT }}/logs/tracking"
path: "{{ COMMON_LOG_DIR }}/tracking/*"
- bucket: "edx-{{ COMMON_ENVIRONMENT }}-{{ COMMON_DEPLOYMENT }}/logs/application" - bucket: "edx-{{ COMMON_ENVIRONMENT }}-{{ COMMON_DEPLOYMENT }}/logs/application"
path: "{{ COMMON_LOG_DIR }}/!(*tracking*)" path: "{{ COMMON_LOG_DIR }}/!(*tracking*)"
- bucket: "edx-{{ COMMON_ENVIRONMENT }}-{{ COMMON_DEPLOYMENT }}/logs/system" - bucket: "edx-{{ COMMON_ENVIRONMENT }}-{{ COMMON_DEPLOYMENT }}/logs/system"
path: "/var/log/*" path: "/var/log/*"
- bucket: "edx-{{ COMMON_ENVIRONMENT }}-{{ COMMON_DEPLOYMENT }}/logs/tracking"
path: "{{ COMMON_LOG_DIR }}/tracking/*"
# #
# vars are namespace with the module name. # vars are namespace with the module name.
......
...@@ -84,18 +84,19 @@ ...@@ -84,18 +84,19 @@
dest={{ COMMON_BIN_DIR }}/{{ aws_s3_sync_script|basename }} dest={{ COMMON_BIN_DIR }}/{{ aws_s3_sync_script|basename }}
when: AWS_S3_LOGS when: AWS_S3_LOGS
- name: run s3 log sync script on shutdown - name: run s3 log sync script on supervisor shutdown
file: > template: >
state=link src=etc/init/sync-on-stop.conf.j2
src={{ COMMON_BIN_DIR }}/send-logs-to-s3 dest=/etc/init/sync-on-stop.conf
path=/etc/rc0.d/S00send-logs-to-s3 owner=root group=root mode=0644
when: AWS_S3_LOGS when: AWS_S3_LOGS
# cron job runs the aws s3 sync script # cron job runs the aws s3 sync script
# this job will log its output to /var/log/aws
- name: cronjob for s3 log sync - name: cronjob for s3 log sync
cron: > cron:
name="cronjob for s3 log sync" name: "cronjob for s3 log sync"
user=root user: root
minute=0 minute: 0
job={{ aws_s3_sync_script }} job: "{{ aws_s3_sync_script }} > /dev/null 2>&1"
when: AWS_S3_LOGS when: AWS_S3_LOGS
start on stopped supervisor
description "sync s3 logs on supervisor shutdown"
script
/bin/bash {{ aws_s3_sync_script }}
end script
...@@ -13,6 +13,10 @@ fi ...@@ -13,6 +13,10 @@ fi
exec > >(tee "{{ aws_s3_logfile }}") exec > >(tee "{{ aws_s3_logfile }}")
exec 2>&1 exec 2>&1
# s3cmd sync requires a valid home
# directory
export HOME=/
shopt -s extglob shopt -s extglob
usage() { usage() {
......
...@@ -57,8 +57,8 @@ ...@@ -57,8 +57,8 @@
- name: set up a cron job to run the script - name: set up a cron job to run the script
cron: cron:
name="log-queue-lenghts" name: "log-queue-lenghts"
job="{{ rabbitmq_app_dir }}/log-rabbitmq-queues.sh" job: "{{ rabbitmq_app_dir }}/log-rabbitmq-queues.sh >/dev/null 2>&1"
# Defaulting to /var/lib/rabbitmq # Defaulting to /var/lib/rabbitmq
- name: create cookie directory - name: create cookie directory
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment