From bf588f993aeba2ea80ab926ad27a65f330e27f9a Mon Sep 17 00:00:00 2001 From: "siraj.yasin" Date: Tue, 2 Mar 2021 02:32:20 +0000 Subject: [PATCH] Copy only current logs from apache2 * `cp -r /var/log/apache2` copies all the archive(*.gz) logs also. So just copy only the current logs access.log, error.log, *vhost.log Change-Id: I2ec55b3da61eb258337f0c0023eb7ebcd9ce1913 --- roles/airship-gather-apache-logs/tasks/main.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/airship-gather-apache-logs/tasks/main.yaml b/roles/airship-gather-apache-logs/tasks/main.yaml index 83f731657..ca4d50189 100644 --- a/roles/airship-gather-apache-logs/tasks/main.yaml +++ b/roles/airship-gather-apache-logs/tasks/main.yaml @@ -17,7 +17,7 @@ - name: ensure directory for apache logs exists file: state: directory - path: "{{ apache_log_dir }}" + path: "{{ apache_log_dir }}/logs" - name: dump apache logs to directory shell: |- @@ -32,7 +32,7 @@ become: yes - name: copy logs - command: "cp -r /var/log/apache2 {{ apache_log_dir }}/logs" + shell: "cp /var/log/apache2/*.log {{ apache_log_dir }}/logs/" become: yes - name: Change ownership of the logs dir