Is it possible to generate HTML output from the log parser? I'd like to directly parse log files which are in log4j format. It is expecting column header to pickup the contents of each line.
Currently I am manually adding the few column header to get the line contents in the select clause. Is it possible to read the content without adding the new line.
I have the plenty of lines of below kind which I want to process for some report.
2013-11-06 16:30:14,019 INFO [com.taliantsoftware.flash.FlashRemotingServerProxy] |qatester|18|com.taliantsoftware.claims.ClaimService.retrieveClaimParticipationForCustomer
2013-11-06 16:30:14,077 INFO [com.taliantsoftware.flash.FlashRemotingServerProxy] |qatester|49|com.taliantsoftware.claims.ClaimService.retrieveClaimProfileItems
2013-11-06 16:30:14,921 INFO [com.taliantsoftware.flash.FlashRemotingServerProxy] |qatester|3|com.taliantsoftware.claims.ClaimService.findClaims
I use the following OQL to get average and max times of each method.
LogParser -i:TSV -iSeparator:space "SELECT SUBSTR(utm, LAST_INDEX_OF(utm, '.')) AS METHOD, AVG(TO_INT(SUBSTR(utm, 11,SUB(LAST_INDEX_OF(utm, '|'), 11)))) AS AVG_TIME, MAX(TO_INT(SUBSTR(utm, 11,SUB(LAST_INDEX_OF(utm, '|'), 11)))) AS MAX_TIME, COUNT(*) FROM \\ced\jboss\node1\temp.log WHERE INDEX_OF(utm, '|developer|')=0 OR INDEX_OF(utm, '|qatester|')=0 AND (AVG(TO_INT(SUBSTR(utm, 11,SUB(LAST_INDEX_OF(utm, '|'), 11)))) > 1000 OR MAX(TO_INT(SUBSTR(utm, 11,SUB(LAST_INDEX_OF(utm, '|'), 11)))) > 1000)GROUP BY SUBSTR(utm, LAST_INDEX_OF(utm, '.')) ORDER BY AVG(TO_INT(SUBSTR(utm, 11,SUB(LAST_INDEX_OF(utm, '|'), 11)))) DESC"
You can generate Xml/Html output by selecting into a html file and specifying a template:
Query
logparser -i:TSV -iSeparator:space -tpl:YOURTEMPLATE.tpl "SELECT /.../ COUNT(*) AS AGG INTO output.html FROM /.../"
YOURTEMPLATE.tpl
<lpheader>
<html>
<head></head>
<body>
<table>
<tr>
<th>method</th>
<th>avg time</th>
<th>max time</th>
<th>count</th>
</tr>
</lpheader>
<lpbody>
<tr>
<td>%METHOD%</td>
<td>%AVG_TIME%</td>
<td>%MAX_TIME%</td>
<td>%AGG%</td>
</tr>
</lpbody>
</table>
</body>
</html>