• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Need some help with Perl

Sunner

Elite Member
I have to write a script that can make a quick report of a logfile.
The logfiles include alot of things, but only two things are important, member ID's, and status codes.
Say we have 5 members, 1 .. 5, and 3 status codes, 555 would be successful audit, 911 would be failed audit, and 000 would be unknown error.

I've come as far as to make the script break the log down to a file that contains all the log entry's stripped down to the member id and status code, example:
1 555
2 555
1 000
3 911

etc etc, member id followed by status code.

Now the last part I need to do is break this into a report that can be read even if there are 1000 entrys, something like:
Member 1
74 555's
11 911's
7 000's
Member 2
192 555's

etc etc...
In other words, a quick report of how things are going 🙂

I havent got all that much time though, and have lots of other stuff to do, so I havent really got enough time to learn the language now.
I'd really appreciate any help anyone could offer with this.

Hope I made some sense in trying to explain.
 
Do a "split" on each line of the log file, then just check if the first parameter is a 1, 2, or 3 and use a counter for each instance. 🙂
Email me if you need some help, I don't check this board very often at all.


After thinking, here's an example, sort of:

WHILE (<logfile>)
{
split(' ', $_);
if ($_[0]==1)
counter1++;
if ($_[1]==2)
counter2++;
if ($_[1]==3)
counter3++;
}

You've got the hard part over with, as you've already made the log file.
 
Back
Top