The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
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
Include PERL script with in the unix shell script ganapati UNIX for Dummies Questions & Answers 1 04-29-2008 01:18 PM
Perl: Run perl script in the current process vino Shell Programming and Scripting 10 12-09-2005 10:45 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rating: Thread Rating: 1 votes, 2.00 average. Display Modes
  #1 (permalink)  
Old 02-24-2009
namishtiwari namishtiwari is offline Forum Advisor  
Registered User
  
 

Join Date: Aug 2007
Location: Bangalore
Posts: 377
Perl Script Help

Hi Experts,

I need help in writing a perl script which can help me in doing the following....

1. Read the user name and session id from the sample log file provided.
2. Print the header as risk_assesment for userid(value).
2. Print the line containing End-to-end time in miliseconds.
3. There are thoudands of user and i have to calculate the time taken for all the users. The entry for the user name starts at the point where these lines are
[CODE]
Next State: risk_assessment
2009-02-18 00:00:11,687 [TP-Processor11] DEBUG BaseController,(TP-Processor11:301) - Next state: assessrisk.htm
Session id can be found in there.


The portion of the log file for the one user id and session id is below---
Code:
2009-02-18 00:00:11,687 [TP-Processor11] INFO  FlowController,(TP-Processor11:121) - Next State: risk_assessment
2009-02-18 00:00:11,687 [TP-Processor11] DEBUG BaseController,(TP-Processor11:301) - Next state: assessrisk.htm
2009-02-18 00:00:11,734 [TP-Processor11] DEBUG RFRiskAssessmentController,(TP-Processor11:122) - Entered callRF
2009-02-18 00:00:11,734 [TP-Processor11] DEBUG RFRiskAssessmentController,(TP-Processor11:122) - Found DID cookie for RF.
2009-02-18 00:00:11,734 [TP-Processor11] DEBUG RFRiskAssessmentController,(TP-Processor11:122) - Returning DID: FXIbNjt4llWFmvPKHSGZoMvZ60WQTd5vFZ3Em+J2jbkZfMHoJxI0XAcDcZfy5G6F
2009-02-18 00:00:11,734 [TP-Processor11] DEBUG RFRiskAssessmentController,(TP-Processor11:122) - Username: 01376128
2009-02-18 00:00:11,734 [TP-Processor11] DEBUG RFRiskAssessmentController,(TP-Processor11:122) - Groupname: MLS
2009-02-18 00:00:11,734 [TP-Processor11] DEBUG RFRiskAssessmentController,(TP-Processor11:122) - Device Signature: 
 {"DEVICESIG":{"VERSION":"1.5","OS_BROWSER":{"browser_ver":"3.0.6","os":"PPC Mac OS X 10.4","browser":"Netscape"},"SCREEN":
 {"colorDepth":"24","availWidth":"1680","width":"1680","height":"1050","availHeight":"1024"},"HTTP_HEADER":
 {"user-agent":"Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US; rv:1.9.0.6) Gecko/2009011912 Firefox/3.0.6"},"OPTIONAL":
 {"SOFTWARE":[]},"USER_PREF":{"sys_lang":"en-us","timezone":"480","user_lang":"en-us"}}}
2009-02-18 00:00:11,734 [TP-Processor11] DEBUG RFRiskAssessmentController,(TP-Processor11:122) - DID retrieved from client system: 
 FXIbNjt4llWFmvPKHSGZoMvZ60WQTd5vFZ3Em+J2jbkZfMHoJxI0XAcDcZfy5G6F
2009-02-18 00:00:11,734 [TP-Processor11] DEBUG RFRiskAssessmentController,(TP-Processor11:122) - IP Address: 216.75.232.70
2009-02-18 00:00:11,734 [TP-Processor11] DEBUG RFRiskAssessmentController,(TP-Processor11:122) - INetAddress received: /216.75.232.70
2009-02-18 00:00:11,734 [TP-Processor11] DEBUG RiskFactory,(TP-Processor11:140) - The object is already created
2009-02-18 00:00:11,734 [TP-Processor11] DEBUG RiskXActionAPI,(TP-Processor11:120) - evaluateRiskAfterLogin: XML Request 
 [<POLICYREQ><MESSAGEID>0</MESSAGEID><CALLERID>4 - MLS - MLS: com.arcot.aok.web.controllers.rf.RFRiskAssessmentController</CALLERID>
 <AUTHPARAMS><ACTION>LOGIN</ACTION><CREDENTIAL>ARCOTID</CREDENTIAL></AUTHPARAMS><IDENTITY>
 <USERID>01376128</USERID><GROUP>MLS</GROUP><SUBGROUP>SUBGROUP2</SUBGROUP></IDENTITY>
 <LOCATION><IPADDRESS>216.75.232.70</IPADDRESS></LOCATION>
 <DEVICEID type="http">FXIbNjt4llWFmvPKHSGZoMvZ60WQTd5vFZ3Em+J2jbkZfMHoJxI0XAcDcZfy5G6F</DEVICEID>
 <DEVICESIG>{&quot;DEVICESIG&quot;:{&quot;VERSION&quot;:&quot;1.5&quot;,&quot;OS_BROWSER&quot;
 :{&quot;browser_ver&quot;:&quot;3.0.6&quot;,&quot;os&quot;:&quot;
 PPC Mac OS X 10.4&quot;,&quot;browser&quot;:&quot;Netscape&quot;},&quot;SCREEN&quot;:
 {&quot;colorDepth&quot;:&quot;24&quot;,&quot;availWidth&quot;:&quot;1680&quot;,&quot;width&quot;:&quot;1680&quot;,&quot;
 height&quot;:&quot;1050&quot;,&quot;availHeight&quot;:&quot;1024&quot;},&quot;HTTP_HEADER&quot;:{&quot;user-agent&quot;:&quot;
 Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US; rv:1.9.0.6) Gecko/2009011912 Firefox/3.0.6&quot;},&quot;
 OPTIONAL&quot;:{&quot;SOFTWARE&quot;:[]},&quot;USER_PREF&quot;:{&quot;sys_lang&quot;:&quot;en-us&quot;,&quot;
 timezone&quot;:&quot;480&quot;,&quot;user_lang&quot;:&quot;en-us&quot;}}}</DEVICESIG></POLICYREQ>]
2009-02-18 00:00:11,734 [TP-Processor11] DEBUG SocketPool,(TP-Processor11:32) - borrowSocket: Trying to get lock localCallGetConnectionFlag false callGetConnectionFlag true
2009-02-18 00:00:11,734 [TP-Processor11] DEBUG SocketPool,(TP-Processor11:37) - borrowSocket: In if(callGetConnectionFlag)
2009-02-18 00:00:11,734 [TP-Processor11] DEBUG SocketPool,(TP-Processor11:68) - borrowSocket: Calling borrowObject
2009-02-18 00:00:11,734 [TP-Processor11] DEBUG PoolableSocketFactory,(TP-Processor11:195) - activateObject not supported : No action taken on Socket[addr=/172.16.64.30,port=7680,localport=3188]
2009-02-18 00:00:11,749 [TP-Processor11] DEBUG SocketPool,(TP-Processor11:70) - borrowSocket: Out of borrowObject
2009-02-18 00:00:11,749 [TP-Processor11] DEBUG SocketPool,(TP-Processor11:78) - borrowSocket: Calling Notify
2009-02-18 00:00:11,765 [TP-Processor11] DEBUG PoolableSocketFactory,(TP-Processor11:184) - Validating Object:Socket[addr=/172.16.64.30,port=7680,localport=3188]
2009-02-18 00:00:11,765 [TP-Processor11] INFO  PoolableSocketFactory,(TP-Processor11:199) - passivateObject called on Socket[addr=/172.16.64.30,port=7680,localport=3188]
2009-02-18 00:00:11,765 [TP-Processor11] DEBUG PoolableSocketFactory,(TP-Processor11:184) - Validating Object:Socket[addr=/172.16.64.30,port=7680,localport=3188]
2009-02-18 00:00:11,765 [TP-Processor11] DEBUG RiskXActionAPI,(TP-Processor11:127) - evaluateRiskAfterLogin: 
 Response Packet [<POLICYSERVERDOC DATATYPE="XML"><POLICYRES><MESSAGEID>0</MESSAGEID><SESSIONID>1:2857064</SESSIONID>
 <ACTION>ALLOW</ACTION><RESPONSECODE>0</RESPONSECODE><ERRORSTRING></ERRORSTRING>
 <ERRORCODE>0</ERRORCODE><TRANSACTIONID>1:2857064</TRANSACTIONID><RISKSCORE>10</RISKSCORE>
 <DEVICEID>FXIbNjt4llWFmvPKHSGZoMvZ60WQTd5vFZ3Em+J2jbkZfMHoJxI0XAcDcZfy5G6F</DEVICEID>
 <RISKDETAIL></RISKDETAIL></POLICYRES></POLICYSERVERDOC>]
2009-02-18 00:00:11,765 [TP-Processor11] DEBUG ResponseMessageParser,(TP-Processor11:214) - Error code:0 ErrorMsg:TRANSACTIONID : 1:2857064
2009-02-18 00:00:11,765 [TP-Processor11] DEBUG ResponseMessageParser,(TP-Processor11:214) - Error code:0 ErrorMsg:SESSIONID : 1:2857064
2009-02-18 00:00:11,765 [TP-Processor11] DEBUG ResponseMessageParser,(TP-Processor11:259) - ArcotPacket MessageID [1]
2009-02-18 00:00:11,765 [TP-Processor11] DEBUG ResponseMessageParser,(TP-Processor11:140) - riskAnalysisBuildResponseFromXML: 
 DeviceID [FXIbNjt4llWFmvPKHSGZoMvZ60WQTd5vFZ3Em+J2jbkZfMHoJxI0XAcDcZfy5G6F]
2009-02-18 00:00:11,765 [TP-Processor11] DEBUG ResponseMessageParser,(TP-Processor11:141) - riskAnalysisBuildResponseFromXML:  AggregatorID []
2009-02-18 00:00:11,765 [TP-Processor11] DEBUG ResponseMessageParser,(TP-Processor11:142) - riskAnalysisBuildResponseFromXML: RiskScore [10]
2009-02-18 00:00:11,765 [TP-Processor11] DEBUG ResponseMessageParser,(TP-Processor11:143) - riskAnalysisBuildResponseFromXML: Action [ALLOW]
2009-02-18 00:00:11,765 [TP-Processor11] DEBUG ResponseMessageParser,(TP-Processor11:144) - riskAnalysisBuildResponseFromXML: SessionId [1:2857064]
2009-02-18 00:00:11,765 [TP-Processor11] INFO  RiskXActionAPI,(TP-Processor11:137) - evaluateRiskAfterLogin: donecom.arcot.riskfortAPI.RiskAssessment@25d8c5
2009-02-18 00:00:11,765 [TP-Processor11] INFO  RiskXActionAPI,(TP-Processor11:59) - evaluateRisk: End-to-end time in millisecond 31
I am in need of some help.
I put the things in red which is required, i think that will help you.

Thanks
NT

Note: I edited the post to move code tags closer to logfile and to break up long lines

Last edited by namishtiwari; 02-26-2009 at 04:04 AM.. Reason: moved code tags, broke up long log lines
  #2 (permalink)  
Old 02-24-2009
KevinADC KevinADC is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2008
Posts: 731
What have you tried?
Where are you stuck?

Hellish log file......
  #3 (permalink)  
Old 02-24-2009
Tom de Tom de is offline
Registered User
  
 

Join Date: Feb 2009
Posts: 23
wow.
Unless I'm missing something there doesn't seem to be anything to tie any of those lines together. If thats the case, you could create your script's logic to check for multiple variables, but thats looks to be hellish in this case also.

So, if you have access to the code you could create your own "debugging" and make that so it that your debugging have a common value. Maybe you could just use the webserver's logs? Looking for the first and last connection?

Is this app yours? Is it a vendor app? What language/code base is it? Is there a database? If there's a database you could use SQL to track your users.

That log file doesn't look like it's going to help you.

Good luck,

Tom de
  #4 (permalink)  
Old 02-24-2009
KevinADC KevinADC is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2008
Posts: 731
Quote:
Originally Posted by Tom de View Post
wow.
Unless I'm missing something there doesn't seem to be anything to tie any of those lines together. If thats the case, you could create your script's logic to check for multiple variables, but thats looks to be hellish in this case also.

So, if you have access to the code you could create your own "debugging" and make that so it that your debugging have a common value. Maybe you could just use the webserver's logs? Looking for the first and last connection?

Is this app yours? Is it a vendor app? What language/code base is it? Is there a database? If there's a database you could use SQL to track your users.

That log file doesn't look like it's going to help you.

Good luck,

Tom de
He did define where a record begins:

Next State: risk_assessment

And this must be the end:

evaluateRisk: End-to-end time in millisecond 31

That would be easy enough to find, but hell if I'm going to try and decipher the rest of the lines in that file. If he can clarify better what records need to pulled from the file and show some effort I am willing to help.
  #5 (permalink)  
Old 02-24-2009
Tom de Tom de is offline
Registered User
  
 

Join Date: Feb 2009
Posts: 23
Unfortunatally, like most log files, the user entries will be mixed within each other. So having the first point of the session and last won't help, as the lines in-between probably won't just be one user, but many users.
  #6 (permalink)  
Old 02-25-2009
namishtiwari namishtiwari is offline Forum Advisor  
Registered User
  
 

Join Date: Aug 2007
Location: Bangalore
Posts: 377
I am not familiar with Perl much, though i know some shell scripting, i am trying to grep the records,but in perl we dont have that option.If you can help me out with some syntax that will me much appericiable.I need three values user name, session id and the end to end time printed. they are there in the records.

Thanks
NT

Last edited by namishtiwari; 02-25-2009 at 02:49 AM.. Reason: added some explanation
  #7 (permalink)  
Old 02-25-2009
Tom de Tom de is offline
Registered User
  
 

Join Date: Feb 2009
Posts: 23
Perl is like grep on steroids. I understand what you are looking for, but I don't think you'll find it in the log/debug output you posted - for the reasons I've posted already.

So, do you have any answers to our posts? What have you tried already ( post code and output plz.).

Tom de

Last edited by Tom de; 02-25-2009 at 02:00 PM..
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:05 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0