Yup, that pretty much matches what I'm trying to do. The only difference, is that I don't want to copy the log files - I want to run the scripts (like the Perl script in your work) on the tomcat server and send the results directly to JMeter through a new web service. Eric, maybe you can't do that because you don't want to or can't touch the system under test on the Solaris box.

So I'm thinking of how I can make the scripts generic enough to suite a wide variety of use cases. I was thinking of letting you query for specific log file fields, so you could specify a regex for the log line contents, a date-time range, and you could ask for the elapsed time between two log entries. The service would return an array of XML elements representing the matching log lines. You could then pull values out using an XPath extractor.

Things you could do:

1. Ensure there are no errors, fatals, or even warnings in the log. Sometimes applications silently swallow errors so you never see them on the HTTP/FTP/TCP client side.

2. If your application is supposed to log certain lines in the log file by design, on particular conditions you can set up in a test, you can now test that.

David

--------------------------------------------------
From: "Eric Smith" <[email protected]>
Sent: Monday, November 02, 2009 7:23 AM
To: "JMeter Users List" <[email protected]>
Subject: RE: Is there a sampler that can read a tomcat log file?

I have done something like this in my testing.
In my case, the response is supposed to contain nothing but success or failure. But I wanted to know how long some stuff took (we do things *after* we respond to the client.) So in some ways I'm using jmeter to drive the service and do some testing... and then use a perl script to validate even more via the log file.

I used scp to get the log files and run a perl script to validate the output of the log files vs. my jmeter test logs (I wrote my own Simpler that logs info.) It checks how long certain things take, correctness between what we got back and what the log file said it should have been... and more.

Since I was running purely in a QA environment - between a VM (jmeter) and Solaris box (server) - I was allowed to set up passwordless ssh between the systems and could copy the log files without any issues. I could also have scripted supplying the password (not my top choice.) My other thought was to share the log directory via NFS and just copy the log file via the mount point.

Eric

-----Original Message-----
From: David Levine [mailto:[email protected]]
Sent: Sunday, November 01, 2009 8:07 PM
To: JMeter Users List
Subject: Is there a sampler that can read a tomcat log file?

Hi,

As part of my functional test, I'd like to assert that a particular line is present (or not present) in the tomcat log file for my application. After looking around at the available samplers and other JMeter tricks, it doesn't look like there's a way to do this without writing code and extending JMeter. Am I correct or is there a way to do this?

OK, there's one kind of hacky way I thought of doing this, which is to write a web service that returns the tomcat log as an XML document, and then use an HTTP Request along with an XPath Extractor post processor, and look for the log line I'm looking for. But that means I'd have to send back the whole log file every time, which could be huge - so I don't like that.

So I was thinking of writing a new sampler, called maybe the Tomcat Log Sampler, that let's you specify a regex query for log lines that you're looking for, and then returns those as XML, so that you can use the XPath Extractor to pull the log lines you're looking for into a variable which you can then subsequently use. The Tomcat Log Sampler would really just be a proxy for a new web service I'd write, that would need to be running on the tomcat web server. The Tomcat Log Web Service would perform the actual query and return the results. That way it could scale.

OK, does this make any sense or am I way off somewhere?

David

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to