Nov 5, 2012, 4:44 AM
Post #5 of 10
Re: [Laurent_R] collect log files remotely and store as 1 file
[In reply to]
Sorry, let me explain a bit further, I need to write a script that collects files from 4 different machines and store them as 1, to get the data i connect to each server a store the names of the files into an array.
Then i connect again and collect all the files in the array which works
use POSIX 'strftime';
my $date = strftime("%Y%m%d", localtime(time - 86400));
@sys1list = system ("/usr/bin/ssh admin\@sys1 '/bin/ls -1 /$main_dir/event_log_$date??????.audit'");
But i cant get the contents of the files into 1 file, using the code below i just get the elements of the array
Once I've collected the data from all 4 machines i would like to cat all of these files into 1 file
$_ =~ s/\/\//\//g;
print " LINE = $_\n";
system (`/usr/bin/scp admin\@sys1:'$srcfile' /home/sys1/data/'$dstname'`);
system (`/bin/cat /home/sys1/data/'$srcfile' >> /home/sys1/data/log_$date`); // doesnt work
/// how can i get the data from the files instead of the array names ??
I've tried using glob but couldn't get it to work. I've managed to collect the data but am struggling to get these files into 1. I also don't like the idea of connecting twice, any suggestions?
Many thanks for your help!
(This post was edited by jeffersno1 on Nov 5, 2012, 5:08 AM)