Skip to content

Commit

Permalink
Merge pull request #349 from opencrvs/ocrvs-8054
Browse files Browse the repository at this point in the history
Send alert for Backup error (ocrvs_8054)
  • Loading branch information
alsmk authored Dec 23, 2024
2 parents 180ea29 + 77fa39a commit 3e038d6
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
7 changes: 7 additions & 0 deletions infrastructure/logrotate.conf
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ include /etc/logrotate.d
rotate 1
}

/var/log/opencrvs-backup.error.log {
missingok
monthly
create 0660 root application
rotate 1
}

/var/log/papertrail.log {
missingok
monthly
Expand Down
4 changes: 4 additions & 0 deletions infrastructure/monitoring/filebeat/filebeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ filebeat.inputs:
enabled: true
paths:
- /var/log/opencrvs-backup.log
- type: log
enabled: true
paths:
- /var/log/opencrvs-backup.error.log
- type: log
enabled: true
paths:
Expand Down
8 changes: 8 additions & 0 deletions infrastructure/server-setup/tasks/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@
state: touch
mode: 'u+rwX,g+rwX,o-rwx'

- name: Create backup logfile for error
ansible.builtin.file:
path: /var/log/opencrvs-backup.error.log
owner: '{{ ansible_user }}'
group: 'application'
state: touch
mode: 'u+rwX,g+rwX,o-rwx'

- name: Create restore logfile
ansible.builtin.file:
path: /var/log/opencrvs-restore.log
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/server-setup/tasks/backups/crontab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
name: 'backup opencrvs'
minute: '0'
hour: '0'
job: 'bash {{ crontab_user_home }}/backup.sh --passphrase={{ backup_encryption_passphrase }} --ssh_user={{ backup_server_user }} --ssh_host={{ backup_hostname }} --ssh_port={{ backup_port }} --remote_dir={{ backup_server_remote_target_directory }} --replicas=1 >> /var/log/opencrvs-backup.log 2>&1'
job: 'bash {{ crontab_user_home }}/backup.sh --passphrase={{ backup_encryption_passphrase }} --ssh_user={{ backup_server_user }} --ssh_host={{ backup_hostname }} --ssh_port={{ backup_port }} --remote_dir={{ backup_server_remote_target_directory }} --replicas=1 >> /var/log/opencrvs-backup.log 2>> /var/log/opencrvs-backup.error.log'
state: "{{ 'present' if (backup_hostname is defined and backup_encryption_passphrase and (enable_backups | default(false))) else 'absent' }}"

##
Expand Down

0 comments on commit 3e038d6

Please sign in to comment.