Commit 00f7ad7a by Joe Blaylock

Configure logrotate to treat edx logs appropriately

* Bugfix to rsyslog configuration; configuration file had missing
  extension
* Logrotate recipes for edx log files
* Files reorganized, renamed
parent d4896b54
......@@ -26,5 +26,8 @@
- cms-env
- logging
# If we set up CMS, we have to set up edx logging
- include: ../../common/tasks/edx_logging_base.yml
# Creates LMS upstart file
- include: ../../gunicorn/tasks/upstart.yml service_variant=cms
---
- name: Install rsyslog configuration for edX
template: dest=/etc/rsyslog.d/99-edx.conf src=edx_rsyslog.j2 owner=root group=root mode=644
notify: restart rsyslogd
tags:
- logging
- name: Install logrotate configuration for edX
template: dest=/etc/logrotate.d/edx-services src=edx_logrotate.j2 owner=root group=root mode=644
tags:
- logging
- name: Touch tracking file into existence
command: touch -a {{log_base_dir}}/tracking.log creates={{log_base_dir}}/tracking.log
tags:
- logging
- name: Set permissions on tracking file
file: path={{log_base_dir}}/tracking.log owner=syslog group=adm mode=750
tags:
- logging
- name: Install logrotate configuration for tracking file
template: dest=/etc/logrotate.d/tracking.log src=edx_logrotate_tracking_log.j2 owner=root group=root mode=644
tags:
- logging
......@@ -22,6 +22,7 @@
with_items:
- ack-grep
- lynx-cur
- logrotate
- mosh
- rsyslog
- screen
......@@ -34,15 +35,21 @@
tags:
- pre_install
- name: Create aliases to the log directory
- name: Create alias from app_base_dir to the log_base_dir
file: state=link src=$log_base_dir path=$app_base_dir/log
tags:
- pre_install
- logging
- name: Create convenience link from log_base_dir to system logs
file: state=link src=/var/log path=$log_base_dir/system
tags:
- pre_install
- logging
- name: Touch edx log file into place
# This is done for the benefit of the rake commands, which expect it
command: touch -a {{log_base_dir}}/edx.log
command: touch -a {{log_base_dir}}/edx.log creates={{log_base_dir}}/edx.log
tags:
- pre_install
- logging
......@@ -55,5 +62,5 @@
- logging
- include: create_venv.yml
- include: rsyslog.yml
- include: edx_logging_base.yml
---
- name: Install rsyslog configuration for edX
template: dest=/etc/rsyslog.d/99-edx src=edx_rsyslog.j2 owner=root group=root mode=644
notify: restart rsyslogd
tags:
- logging
{{log_base_dir}}/*/edx.log {
create
compress
copytruncate
delaycompress
dateext
missingok
notifempty
daily
rotate 90
size 1M
}
{{log_base_dir}}/tracking.log {
create
compress
delaycompress
dateext
missingok
notifempty
daily
rotate 365000
size 1M
}
......@@ -32,6 +32,9 @@
- lms-env
- logging
# If we set up LMS, we have to set up edx logging
- include: ../../common/tasks/edx_logging_base.yml
# Install ssh keys for ubuntu account to be able to check out from mitx
# Temprory behavior, not needed after June 1. Perhaps still useful as a recipe.
# {{ secure_dir }} is relative to the top-level playbooks dir so there is some
......
......@@ -29,8 +29,22 @@
service: name=nginx state=started
tags:
- nginx
- name: Create nginx log file location (just in case)
file: path={{log_base_dir}}/nginx state=directory owner=syslog group=adm mode=2770
tags:
- nginx
- logging
# Commented out until default config has nginx log to {{log_base_dir}}/nginx
# and also until default logrotate task 'nginx' gets removed
###
#- name: Set up nginx access log rotation
# template: dest=/etc/logrotate.d/nginx-access src=edx_logrotate_nginx_access.j2 owner=root group=root mode=644
# tags:
# - logging
#
#- name: Set up nginx access log rotation
# template: dest=/etc/logrotate.d/nginx-error src=edx_logrotate_nginx_error.j2 owner=root group=root mode=644
# tags:
# - logging
{{log_base_dir}}/nginx/access.log {
create
compress
delaycompress
dateext
missingok
notifempty
daily
rotate 90
size 1M
}
{{log_base_dir}}/nginx/error.log {
create
compress
delaycompress
dateext
missingok
notifempty
daily
rotate 90
size 1M
}
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