Start lines with timestamps in errors for logstash

Move timestamps to start of line in errors file for indexing it
in logstash.

Change-Id: I94b6e44c6a03e25c0da659013b37bb6403a99ffd
This commit is contained in:
Sagi Shnaidman 2017-11-15 16:55:03 +02:00
parent 4e5c06df20
commit 993a8f8572

View File

@ -189,7 +189,8 @@
- name: Collect errors
shell: >
grep -rE '^[-0-9]+ [0-9:\.]+ [0-9 ]*ERROR ' /var/log/ > /tmp/errors.txt;
grep -rE '^[-0-9]+ [0-9:\.]+ [0-9 ]*ERROR ' /var/log/ |
sed "s/\(.*\)\(20[0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9]\+\)\(.*\)/\2 \1\3/g" > /tmp/errors.txt;
mv /tmp/errors.txt /var/log/extra/errors.txt
- name: Create a index file for logstash