> ## Content Index
> Fetch the complete content index at: https://kudithipudi.org/llms.txt
> Use this file to discover other available public pages before exploring further.

# HOW TO : Combining Perl and Zoho to produce reports
- URL: https://kudithipudi.org/how-to-combining-perl-and-zoho-to-produce-reports/
- Published: 2011-01-27T04:00:27.000Z
- Updated: 2011-01-27T04:00:27.000Z
- Description: This HOW TO is more for my notes. We had a request at work, where we had to parse some log files and create a graph...
- Author: admin
- Tags: HOWTO, Programming, Technology, Uncategorized, Web, #wp, #wp-post, #Import 2026-08-23 02:32

This HOW TO is more for my notes. We had a request at work, where we had to parse some log files and create a graph from the data in the log files.

The log files looked like this

\[bash\]  
0m0.107s  
0m0.022s  
0m0.015s  
2011-01-05\_02\_22  
0m0.102s  
0m0.024s  
0m0.014s  
2011-01-05\_02\_23  
\[/bash\]

I wrote the following perl script to get the log file to look as such

\[bash\]| 0m0.107s| 0m0.022s| 0m0.015s| 2011-01-05 | 02:22

| 0m0.102s| 0m0.024s| 0m0.014s| 2011-01-05 | 02:23 \[/bash\]

perl script

\[perl\]  
#!/usr/bin/perl  
\# Modules to load  
\# use strict;  
use warnings;

\# Variables  
my $inputFile = ‘input.txt’;  
my $version = 0.1;

my $logFile = ‘parsed\_input.csv’;

\# Sub Functions  
sub Log($$$);  
sub Trim($);

\# Clear the screen  
system $^O eq ‘MSWin32’ ? ‘cls’ : ‘clear’;

\# Open the output log file  
open(LOGFILE,"> $logFile") || die "Couldn’t open $logFile, exiting $!\\n";

\# Open the input file  
open(INPUTFILE,"< $inputFile") || die "Couldn’t open $inputFile, exiting $!\\n";

\# Process the input file, one line at a time  
while (defined ($line = <INPUTFILE>)) {  
chomp $line;  
\# Check for blank line  
if ($line =\~ /^$/)  
{  
\# Start a new line in the output  
print LOGFILE "\\n";  
}  
else  
{  
\# Split the date and time  
if ($line =\~ /2011/)  
{  
@date = split (/\_/,$line);  
print LOGFILE "| $date\[0\] | $date\[1\]:$date\[2\]";  
}  
else  
{  
\# Write the value to the output  
print LOGFILE "| $line";  
}  
}  
}  
\[/perl\]  

I then took the parsed log files and imported them into the cloud based reporting engine provided by Zoho at http://reports.zoho.com 

The final result are these reports

[SERVER1](http://reports.zoho.com/ZDBDataSheetView.cc?OBJID=144766000000038450&STANDALONE=true&ZDB%5FTHEME%5FNAME=blue&REMTOOLBAR=false&INCLUDETITLE=true&INCLUDEDESC=true&ref=kudithipudi.org)

[SERVER2](http://reports.zoho.com/ZDBDataSheetView.cc?OBJID=144766000000038487&STANDALONE=true&ZDB%5FTHEME%5FNAME=blue&REMTOOLBAR=false&INCLUDETITLE=true&INCLUDEDESC=true&ref=kudithipudi.org)

Did I say, I love technology? 🙂