Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Mysql and tail

by hydo (Monk)
on Oct 16, 2003 at 12:45 UTC ( #299726=note: print w/replies, xml ) Need Help??


in reply to Mysql and tail

|| 1. What Perl modules are recommended here?

| the modules you are looking for are DBI and DBD::MySQL.

I would also suggest looking at Class::DBI. It's really really nice.

As for how I would do it, and this is completely untested but, I would probably insert a column just for keeping track of line numbers. The program that pulls the logs in can increment this easily and you can do the same on the 'tail'-ish program.

When your dbtail is run, it finds the highest number in that column, backs up say 5 lines or so, displays that to the highest number. Then in a loop or something like that, query for a higher number than your last count.

I'm pretty tired and that could very well not work at all, but at the moment it seems like a good start.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://299726]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2023-10-03 14:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?