Commit cc9f3727 by John Jarvis

switching to a single bash script instead of logrotate

parent 1428c990
...@@ -39,9 +39,16 @@ COMMON_S3_LOGS: false ...@@ -39,9 +39,16 @@ COMMON_S3_LOGS: false
COMMON_S3_LOGS_NOTIFY_MAIL: dummy@example.com COMMON_S3_LOGS_NOTIFY_MAIL: dummy@example.com
# Separate buckets for tracking logs and everything else # Separate buckets for tracking logs and everything else
# You should be overriding the environment and deployment vars # You should be overriding the environment and deployment vars
COMMON_S3_LOGS_APP_BUCKET: "{{ COMMON_ENVIRONMENT }}-{{ COMMON_DEPLOYMENT }}-app-logs" COMMON_S3_LOG_PATHS:
COMMON_S3_LOGS_TRACKING_BUCKET: "{{ COMMON_ENVIRONMENT }}-{{ COMMON_DEPLOYMENT }}-tracking-logs" - bucket: "{{ COMMON_S3_LOGS_APP_BUCKET }}"
paths:
# globs are ok, do not use brace expansion
# everything except tracking logs
- "{{ COMMON_LOG_DIR }}/!(*tracking*)"
- "/var/log/*"
- bucket: "{{ COMMON_S3_LOGS_TRACKING_BUCKET }}"
paths:
- "{{ COMMON_LOG_DIR }}/*tracking*"
common_debian_pkgs: common_debian_pkgs:
- ntp - ntp
- ack-grep - ack-grep
......
...@@ -9,10 +9,4 @@ ...@@ -9,10 +9,4 @@
daily daily
rotate 90 rotate 90
size 1M size 1M
{% if COMMON_S3_LOGS -%}
sharedscripts
postrotate
{% include s3-application.j2 %}
endscript
{% endif -%}
} }
...@@ -8,9 +8,6 @@ ...@@ -8,9 +8,6 @@
compress compress
postrotate postrotate
reload rsyslog >/dev/null 2>&1 || true reload rsyslog >/dev/null 2>&1 || true
{% if COMMON_S3_LOGS -%}
bash /edx/bin/send-logs-to-s3 "/var/log/syslog*" s3://{{ COMMON_S3_LOGS_APP_BUCKET }}
{% endif -%}
endscript endscript
} }
......
...@@ -8,11 +8,4 @@ ...@@ -8,11 +8,4 @@
daily daily
rotate 365000 rotate 365000
size 1M size 1M
{% if COMMON_S3_LOGS -%}
sharedscripts
postrotate
{% include s3-tracking.j2 %}
endscript
{% endif -%}
} }
...@@ -108,5 +108,8 @@ instance_id=$(curl -s http://169.254.169.254/latest/meta-data/instance-id) ...@@ -108,5 +108,8 @@ instance_id=$(curl -s http://169.254.169.254/latest/meta-data/instance-id)
ip=$(curl -s http://169.254.169.254/latest/meta-data/local-ipv4) ip=$(curl -s http://169.254.169.254/latest/meta-data/local-ipv4)
s3_path="${2}/$sec_grp/" s3_path="${2}/$sec_grp/"
{% for bucket in COMMON_S3_LOG_PATHS -%}
$noop $S3CMD sync $1 ${2}/$sec_grp/${instance_id}-${ip}/ {% for path in bucket.paths -%}
$noop $S3CMD sync {{ path }} {{ bucket }}/$sec_grp/${instance_id}-${ip}/
{% endfor %}
{% endfor %}
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