Thread Bestimmte sahen von Logfile ablesen vergleichen (4 answers)
Opened by perlineu at 2018-09-06 22:51

perlineu
 2018-09-06 22:51
#188902 #188902
User since
2018-09-06
1 Artikel
BenutzerIn
[default_avatar]
Hallo, ich muss ein Perl Script schreiben, dass von ein Logfile bestimmte Daten abliest und damit arbeitet.
Das Logfile sagt:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
BR0063I 77 of 77 files processed - 430130.359 of 430130.359 MB done
BR0115I Compression rate for all files 4.26:1
BR0052I BRBACKUP completed successfully
BR0280I BRBACKUP time stamp: 2018-08-21 23:26:43
BR0292I Execution of BRARCHIVE finished with return code 0
Backupgroesse=$(ls -l /C/logfile.txt | awk '{ print $5 }')
echo $Backupgroesse;
BR0063I 77 of 77 files processed - 430130.359 of 430130.359 MB --> 430130


backupdatum=$(cat /C/logfile.txt | grep BR0280I | tail -1 |awk '{ print $5 }')
echo $backupdatum;
BR0280I BRBACKUP time stamp: 2018-08-21 23:26:43 --->2018-08-21

backupmeldung=$(cat /C/logfile.txt | grep BR0292I | awk '{ print $5,$6,$7,$8,$9 }')
echo $backupmeldung;
BR0292I Execution of BRARCHIVE finished with return code 0 --> finished with return code 0

ergb=$(cat /C/logfile.txt | grep BR0292I | awk '{ print $9,$10 }')
dateig=$(ls -al /C/logfile.txt | awk '{ print $5 }')
BR0292I Execution of BRARCHIVE finished with return code 0 -->0

es muss gerechnet werden: time stamp mit time wenn älter als 7 Tage allarm. Backupgroesse: 430130* (*/ 4.26:1*/) *4.26*1= 183235380 das mit dem Ordner verglechen. wenn finished with return code 0 ist gut wenn finished with return code 12 sofort Mail kann bitte jemand mr helfen, die ganze grep/awk/ abfragen i Perl zu schreiben? Vielen Dank

modedit Edited by pq: code-tags hinzugefügt
Last edited: 2018-09-08 12:33:49 +0200 (CEST)

View full thread Bestimmte sahen von Logfile ablesen vergleichen