File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes parsing logfile Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "parsing logfile" Watch "parsing logfile" New topic
Author

parsing logfile

ranga shreya
Greenhorn

Joined: Mar 05, 2005
Posts: 20
Hi there,
I am getting a appache logfile so I have to parse the file and and store it in a database table what are the steps involved here...
i mean how to parse the log file.
sample line from my log file.
216.148.244.91 - - [11/Mar/2005:11:05:27 -0500] "GET /tracker.html?retailer=Test+Retailer&order=xyz123&uniqueId=12345&sku=sku-00005&prodName=the%20greatest%20product%20in%20all%20the%20world&qty=1&unitPrice=15.25 HTTP/1.0" 200 - "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"


Thanks,<br />Ranga.<br />Life is precious so enjoy the life each moment and utilise it at the same time.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30353
    
150

Ranga,
Before you go about trying to do this yourself, take a look at log4j's database appender. It looks like this is from a web server access log, rather than log4j, but you can still get some ideas.

Then you can decide on what your schema should be. For example, it looks like it would be useful to store the IP address, date/time, etc.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: parsing logfile