From a33d943195df928b42a3ffb9738901272b93283d Mon Sep 17 00:00:00 2001 From: Attila Darazs Date: Tue, 24 Jan 2017 11:20:17 +0100 Subject: [PATCH] collect-logs: broader txt.gz rename conditions In addition to known text file extensions, also rename files without extension in the /var/log and /etc directories. Change-Id: Ia9898816831392951cd927b7661d4d8fdcb4d007 --- roles/collect-logs/tasks/publish.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/roles/collect-logs/tasks/publish.yml b/roles/collect-logs/tasks/publish.yml index 917fd8770..1282aabae 100644 --- a/roles/collect-logs/tasks/publish.yml +++ b/roles/collect-logs/tasks/publish.yml @@ -28,8 +28,10 @@ - name: Rename text based files to end with txt.gz extension shell: > find {{ artcl_collect_dir }} -type f | - awk '/\.(conf|ini|json|sh|log|yaml|yml)\.gz$/ { - renamed=$0; sub(/\.gz$/, ".txt.gz", renamed); system("mv " $0 " " renamed) }'; + awk 'function rename(orig) + { new=orig; sub(/\.gz$/, ".txt.gz", new); system("mv " orig " " new) } + /\.(conf|ini|json|sh|log|yaml|yml)\.gz$/ { rename($0) } + /(\/var\/log\/|\/etc\/)[^ \/\.]+\.gz$/ { rename($0) }'; when: artcl_txt_rename|bool - name: upload to the artifact server using pubkey auth