No, no, as I said I AM using the samples as the data to test. Anyways I figured out the problem. I pasted your code:
while (<FILE>) {
chomp;
my @temp = split(/\s+/);
my @data = (splice(@temp, 0, 7), undef, splice(@temp, -9))...
I agree guys, the sample code posted worked fine. The data is the same, because I created a test data file with only one entry in it:
myhost# ./test.pl -d test
reading file /home/test/ftplogs/archive/test/ftp.log
Use of uninitialized value in string eq at ./test.pl line 109, <FILE> line 1...
Hi Kevin,
Thanks for all the help BTW. :)
For some reason the $size variable is not getting populated. I get an error saying :
"Use of uninitialized value in string eq at ./test.pl line 109, <FILE> line 1"
This is line 109 :
unless ($size eq "-" || $duration eq "-") {
$duration sems to be...
How would I put this splice into my while statement?
# OPEN LOG FILE DIRECTORY
# -----------------------
opendir(DIR, "$archive_dir/$dir") or die "Can't open $archive_dir/$dir: $!";
while (defined ($file = readdir DIR)) {
next unless $file =~ /^ftp.log/;
print "reading file...
The file extension could be anything, or perhaps no extension at all. All the fields are always populated. So there will be eight fields before the file name and nine after. Does that help?
Thanks,
Icky
A little more information:
A log entry may look like this -
Mon Oct 2 11:20:10 2006 23 192.168.0.1 87269520 /xyz2_00HR_ASD_70804_1_86GB_3ABC/1_SPACE IN_FILE_PATH/70804123401.45210221.865760.tar b _ o r janedoe ftp 0 * c
the next entry may be this -
Mon Oct 2 11:22:10 2006 23 192.168.0.3...
Thanks Paul,
How would I stick this in my loop?
while (<FILE>) {
($dow, $month, $day, $time, $year, $duration, $clientip, $size, $path, $ttype, $specialact, $type, $mode, $uid, $service, $authm, $authu, $st
atus) = split(/\s+/);
Icky
Hi All,
I have a parser that reads in ftp logs and does an insert into a database. Everything parses, and inserts fine. However, on occasion, a user has created a file or file path with whitespace in the name, i.e. - "/userhome/my files/bigfile".
The parser picks up the whitespace between "my...
I am writing a parser to read in ftp log files and insert into a databse. I have everything working fine, except the legacy billing system being used generates bills for each user instead of the master account. Therefore, as a bandaid, I need to attach an account field to each uid for each...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.