raj8 has asked for the wisdom of the Perl Monks concerning the following question:
I have been working on home project to check the status of syncing my documents. The syncing process is called a job and and for each job I want to check for the status of three things for on the current day: 1.) Synchronizing started 2.) Synchronizing finished 3.) Summary with Files Processed, Files copied and Bytes processed. Eventually, I would like to take each part such as Files processed, Files copied and Bytes processed and put it in a MySQL database so that I can just run queries against it to check on past Successes and make some stats. That said, I am having problems with getting all three of the items together for each individual job. I appreciate any assistance, suggestions, ideas. Thanks again.
my $today = get_cur_time(); ### Defining Jobs @jobs = ("Allway Job"); ### Defining Print Header print "\n======================================\n"; print "\n Homebrew Reporting Program\n\n"; print " Today: $today\n"; print "\n======================================\n\n"; ### Opening Allway Sync Log File open(FH1,"C:\\Documents and Settings\\localadmin\\Application Data\\Sy +nc App Settings\\_SYNCAPP\\default.log") || die "Cannot open file:$!\n"; ### keep Log open while reading while((<FH1>)) { ### $date =~ s/\[//; foreach $job (@jobs) { if( $date eq $today && /Synchronizing started/ || /Synchronizing finis +hed/ || /Summary/ ) { #$syncStartD = substr($_,1,9); #$syncStartT = substr($_,11,7); #$syncStartjobName = substr($_,20,120); #$filesProcessed = substr($_,21,44); print $_; # "$syncStartD$syncStartT$syncStartjobName$filesProcessed\ +n"; }; }; }; ### Subroutines for current date sub get_cur_time { my ($Day, $Month, $Year) = (localtime(time))[3..6]; $Year += 1900; $Month = sprintf '%02d', $Month + 1; $Day = sprintf '%02d', $Day; return "$Month/$Day/$Year"; }; __DATA__ [3/21/2008 12:48 PM] Synchronizing started, job: "Allway Job" [3/21/2008 12:48 PM] Analyzing finished, job: "Allway Job" [3/21/2008 12:48 PM] Deleting: "C:\test\_SYNCAPP\temp" ... [3/21/2008 12:48 PM] Deleting: "c:\test\_SYNCAPP\temp" ... [3/21/2008 12:48 PM] Preparing metadata ... [3/21/2008 12:48 PM] Flushing drive "\\.\C:" buffers ... [3/21/2008 12:48 PM] Writing File: C:\test\_SYNCAPP\metadata.xml" ... [3/21/2008 12:48 PM] Writing File: "c:\test\_SYNCAPP\metadata.xml" ... [3/21/2008 12:48 PM] Flushing drive "\\.\C:" buffers ... [3/21/2008 12:48 PM] Flushing drive "\\.\c:" buffers ... [3/21/2008 12:48 PM] Synchronizing finished, job: "Allway Job" [3/21/2008 12:48 PM] Summary: Files processed: 18; Files copied: 0; By +tes processed: 180,372; Bytes copied: 0.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Parsing Unstructured Data
by NetWallah (Canon) on Mar 22, 2008 at 20:05 UTC | |
by raj8 (Sexton) on Mar 23, 2008 at 02:31 UTC | |
|
Re: Parsing Unstructured Data
by apl (Monsignor) on Mar 22, 2008 at 19:42 UTC |