http://www.perlmonks.org?node_id=748663


in reply to Re^3: regex: extract multiple number of date patterns from certain lines
in thread regex: extract multiple number of date patterns from certain lines

Of course you are right, there is nothing in POE::Wheel::FollowTail limiting me to regex. P.W.FT was just a nice framework I grabbed about 3 years ago to watch a bunch of logfiles for various patterns and then hand these off to arbitrary processing.

To keep the core log monitor small and clean and hopefully fast all it will accept is regex patterns. A config file defines these and the module to use for each one. When a pattern matches the 'forward' method of the registering object (instantiated at start up) is called and given refs to the pattern involved, the log file name and the matches. Code of arbitrary complexity can be executed in the object.

In the normal way of things the requirements started very simple years ago, even allowing a config file full of regexen was called overkill then by some. Now three years down the line this code runs fine on hundreds of production servers and happily fulfils all sorts of varied requirements. As I said I get a second bite of the cherry in the object the match is passed too. I am now using your regex (thanks) and post processing in the object to split the trailing dates then send them onto the sysmanagement bus, all works great.

I could change the monitor to accept coderefs as well as regex but that would involve re-write testing and change controlled deployment throughout a monster bureaucracy, of core production code. When I started this node I just thought I was missing something blindingly obvious in not getting my regex to work as I wanted, I was vexed. Now I know I had hit a limit of what is reasonable in a single line of regex.

Thanks again for your time, it is appreciated,
R.

Pereant, qui ante nos nostra dixerunt!