#!/usr/bin/perl -w ######################################## # Modules use strict; # parameter Definition before use them #################################### # modules ####################################### # Paramet Definition my ($sec,$min,$hour,$mday,$mon,$year,$wday,$ydat,$isdst); my ($jahr,$monat,$tag,$Xzeit,$Xdatum); my $ct=1; # counter parameter my $lines; # line parameter my @data1 =(""); my $kw1="user.alert"; my $kw2="user.crit"; my $kw3="user.err"; my $ukw1="WLAN"; ################## # main programm system("clear"); # Refresh the terminal #################### # Time procedure ($sec,$min,$hour,$mday,$mon,$year,$wday,$ydat,$isdst)=localtime(); # Get TimeStamp-Elements $jahr=$year;$monat=$mon+1;$tag=$mday;$jahr=$year; $jahr=$year +1900; # Set the Year if (length($monat) == 1){$monat="0$monat";} # Fillup the number amount if(length($tag) == 1){ $tag="0$tag";} if(length($hour) == 1){ $hour="0$hour";} if(length($min) == 1){ $min="0$min";} if(length($sec) == 1){ $sec="0$sec";} #$Xdatum=$tag.".".$monat.".".$jahr; $Xdatum=$tag.".".$monat; $Xzeit=$hour.":".$min; ######################### # Logfile analysis open(InFile,$ARGV[0])or die $!; # read Inputfile open(OutFile,">/home/cohama/SysLog/$Xdatum._SysLog_PTA-SIP.log")or die $!; while ($lines = ) { switch($lines){ case 1: =~ m{$kw1} {push(@data1,$lines);break; # read File line per line case 2: =~ m{$kw2} {push(@data1,$lines);break; case 3: =~ m{$kw3} {push(@data1,$lines);break; } ################################################# } print "Store2File \n"; print OutFile @data1; print "Close the files \n"; close(InFile);close(OutFile); # write Array 2 File