perl script help

shell scripts

Thread Tools Search this Thread
# 1  
Old 05-28-2009
perl script help


I am writing a perl script and need some in extracting some data. Basically it is a Log Analyzer and there are multiple log files from where the data comes.

i am done with the grep part of the userID with this code-
#!/usr/bin/perl -w
open(VALUE, "< arcotwebfort_20May09_00_03_55.log");
@stock = <VALUE>; 
@matches = (grep(/$username/, @stock));
print @matches;

it gave me this output--

i got the sessionID's from this,they are-10088781,10088815. like this there are plenty of sessionID related to a single user.

i collected this information in an array @matches. now i want to take sessionID's from this array and search for the sessionID in the logfile which AuthMechanism it belongs to.
There are three-four AuthMechanism to which a user can belong.they are--

On the basis of these mechanisms i need to know the user belongs to which mechanism. This part is very tricky for me and i am stuck here as i am not well wersed with Perl and learning it.
I will upload my logfile. please suggest me to proceed further.
If my questions are not clear to you please let me know i will try to explain them better.Please help me in proceeding further, i am also trying to write it myself.
What i want is what the given user is doing in the session id and the session id is related to which mechanism.

So let say my script takes username as arguememnt, i am able to print all the information that is related to that user with sessionID's. this sessionID is related to diffrent Authentication mechanism mentioned earlier.The user can belong to any or all basic criteria is that the user belongs to which mechanism and he is doing what(data related to the username in mechanisms)
The output should be like this--
say i gave the input username as 01018603, i will be able to get the output as--
the example belongs to one AuthMechanism ie QnA
if [ sessionID_No_Got_from_the_username_list == QnA sessionID ]; then
print all the data inside that sessionID that relates to user with timestamp
print this also
Handle_NSPAdvice:: Handling NSPAdvice for mechanism [2] with time stamp.

Any advice on the script or help will be very greatful.

Last edited by namishtiwari; 06-12-2009 at 06:53 AM..
# 2  
Old 05-29-2009

I am explaing these question as this will be easy to understand the problem-
1. How are you relating session ids to users? Is the user id listed in the logfile or do you have a separate list?

2. How are the session ids related to authentication methods? Again, is this information available in the logfile or do you have a separate list?

1.. Yes userID is is listed in the logfile by name userName. When we search for the userName, it gives us details about the userName and which sessionID's it belongs.SessionID comes after tid value and leaving one more field after that,consisting of 8digits. each seesion id gives us the details about which mechanism it belongs to.
2. Each sessionID belongs to a mechanism,if we specifically search for the SessionID's it will show the details like this.

Thi sdetails will simply tell us which mechanis it belong as we can see the lines like "QnA Session Id :[1:10081229]" in the sessionID related data. This information is available in the logfile. QnAModule is there in the logfile uploaded.
I think now question will be much clear,if not still kindly tell me. and i will try to elaborate more.


Last edited by namishtiwari; 06-12-2009 at 06:54 AM..

Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
PERL: In a perl-scripttTrying to execute another perl-script that SETS SOME VARIABLES ! alex_5161 Programming 1 03-03-2018 07:31 PM
Excuting perl script from within a perl script with variables. mrlayance Shell Programming and Scripting 1 12-10-2013 04:05 PM
Call a Perl script within a bash script and store the ouput in a .txt file mecaka Shell Programming and Scripting 6 11-22-2013 06:07 PM
Perl : embedding java script with cgi perl script scriptscript Shell Programming and Scripting 1 03-21-2013 01:58 PM
executing perl script from another perl script : NOT WORKING giridhar276 Shell Programming and Scripting 3 08-03-2012 03:34 AM
problem with exporting vairable from one perl cgi to another perl cgi script while redirecting. Arun_Linux Web Programming 3 02-17-2012 12:00 PM
calling a perl script with arguments from a parent perl script grajp002 Shell Programming and Scripting 1 02-03-2012 12:57 AM
HELP on Perl array / sorting - trying to convert Korn Shell Script to Perl newbie_01 Shell Programming and Scripting 3 11-06-2011 01:26 AM
Perl :How to print the o/p of a Perl script on console and redirecting same in log file @ same time. butterfly20 Shell Programming and Scripting 2 01-13-2011 08:35 AM
perl/unix: script in command line works but not in perl kpddong Shell Programming and Scripting 2 01-11-2011 02:27 PM
Send "perl -e '...' " command through SSH, from a perl script clrg Shell Programming and Scripting 2 07-14-2010 02:00 PM
Calling a perl script from a perl script new2ss Shell Programming and Scripting 6 05-24-2009 06:03 PM
How to Turn perl one-liners into full perl script? EDALBNUG UNIX for Dummies Questions & Answers 1 02-04-2009 10:49 AM
[Perl] Accessing array elements within a sed command in Perl script userix Shell Programming and Scripting 2 10-03-2008 01:05 PM
Perl: Run perl script in the current process vino Shell Programming and Scripting 10 12-09-2005 10:45 AM