Skip to content

Commit 3e038d6

Browse files
authored
Merge pull request #349 from opencrvs/ocrvs-8054
Send alert for Backup error (ocrvs_8054)
2 parents 180ea29 + 77fa39a commit 3e038d6

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

infrastructure/logrotate.conf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ include /etc/logrotate.d
7272
rotate 1
7373
}
7474

75+
/var/log/opencrvs-backup.error.log {
76+
missingok
77+
monthly
78+
create 0660 root application
79+
rotate 1
80+
}
81+
7582
/var/log/papertrail.log {
7683
missingok
7784
monthly

infrastructure/monitoring/filebeat/filebeat.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ filebeat.inputs:
1111
enabled: true
1212
paths:
1313
- /var/log/opencrvs-backup.log
14+
- type: log
15+
enabled: true
16+
paths:
17+
- /var/log/opencrvs-backup.error.log
1418
- type: log
1519
enabled: true
1620
paths:

infrastructure/server-setup/tasks/application.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@
4949
state: touch
5050
mode: 'u+rwX,g+rwX,o-rwx'
5151

52+
- name: Create backup logfile for error
53+
ansible.builtin.file:
54+
path: /var/log/opencrvs-backup.error.log
55+
owner: '{{ ansible_user }}'
56+
group: 'application'
57+
state: touch
58+
mode: 'u+rwX,g+rwX,o-rwx'
59+
5260
- name: Create restore logfile
5361
ansible.builtin.file:
5462
path: /var/log/opencrvs-restore.log

infrastructure/server-setup/tasks/backups/crontab.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
name: 'backup opencrvs'
2121
minute: '0'
2222
hour: '0'
23-
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'
23+
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'
2424
state: "{{ 'present' if (backup_hostname is defined and backup_encryption_passphrase and (enable_backups | default(false))) else 'absent' }}"
2525

2626
##

0 commit comments

Comments
 (0)