Google Groups Home
Help | Sign in
Message from discussion A little Direction Please
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Andy  
View profile
 More options May 13, 11:25 am
Newsgroups: comp.lang.perl.misc
From: Andy <Ramr...@gmail.com>
Date: Tue, 13 May 2008 08:25:00 -0700 (PDT)
Subject: A little Direction Please
Greets :)

Q; I am trying to learn how to define some variables

The basis of this script is to Scrub log files for ftp logins,
seperate the successful logins

Then create an array ( I hope the right terminology) to seperate it

I hardcoded the log file, because I am looking for a way for it to
scrub *.logs on a server

but ...hey step by step right.

Fields: date time c-ip cs-username cs-method cs-uri-stem sc-status sc-
bytes cs-host
           2008-01-20 00:00:02 x.x.x.x 0598_Andy [6952041]sent /
0598_Andy/qff0598.zip 226 0 -

This field 226 0 - is a successful login

My plan is to scrub the logs, export to file.

sort fields into variable.

I hope in the end to get

1..log of successful logins
2.log of last successful login ( I think I am going to try date
comparison from most recent to last.)
3 be able to parse the fields and get data.

I know that there are those of you who are advanced, I would
appreciate any directions or help.

Again I am trying to put this together this is what  I have so far.

#!/usr/bin/perl
use strict;
use warnings;

open(INPUT, '<', "ex080120.log")or die("Could not open log file.");
open(OUTPUT, '>',"ftpacct.log")or die("Could not open log file.");
my $extractedLine;
while (<INPUT>) {
 my $line = $_;
         if ($line =~ m/^(.+226\s+0\s+-\s+.*)$/) {
              print OUTPUT "$1\n";
         }

}

close(INPUT);
close(OUTPUT);
exit;

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google