camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bwtaylor <bryan_w_tay...@yahoo.com>
Subject Tailing a Rotating Log
Date Sat, 02 May 2009 22:15:41 GMT

I have information that is coming to me in the logs of an application that I
don't control. I want to take the lines of the log as they are written (like
tail -f in unix) and process each line with Camel. Unfortunately for me, the
"current" log file name changes because the app uses log rotation. The
filenames have a structured pattern like {stub}-{date-time}.log

It looks like Camel 2.0 will allow me to use the stream component to tail a
file, but it also appears to require the filename to be static.

One solution idea would go like this:
 1) poll the directory list for files matching the log file pattern
 2) determine the latest file and pass just this file through an idempotency
filter
 3) When a new filename arrives, stop the old stream component based route,
start a new one

Is something like this possible? Has anybody written a camel Processor that
dynamically modifies Camel routes? Another idea would be to modify the file
parameter in place in the existing route built by the stream component. What
are the pro's and con's of this approache vs dynamic route building?

Also, I see the stream component will support a scanStreamDelay parameter,
which defaults to 0 and specifies the millis between reads. Let's say I use
this and 17 lines have arrived when it reads. Do these all go in one message
or 17?
-- 
View this message in context: http://www.nabble.com/Tailing-a-Rotating-Log-tp23350759p23350759.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.


Mime
View raw message