On 30 Dec 2004, at 13:26, Daniel Gaddis wrote:
is there a utility like mysqlbinlog but instead processes the query log?
I would like to reprocess the queries from the query log.
I don't see another reply to this on the list, so I hope it helps - the query log is already in plain-text, so you don't need something to fish the queries out of an unfriendly format.
This bit of perl should be a good starting point.
elephant:/var/log/mysql# cat pullqueries.pl #!/usr/bin/perl -w
use strict;
while (my $line = <>) {
if ($line =~ /Query/) {
my (undef, undef, undef, undef, $display) = split(/ /, $line, 5);
print $display;
}
}
example :
elephant:/var/log/mysql# tail -n 20 mysql.log | perl pullqueries.pl
SELECT fname from images where groupid='4' order by viewno desc limit 0,1
SELECT fname from images where groupid='3' order by viewno desc limit 0,1
SELECT fname from images where groupid='2' order by viewno desc limit 0,1
SELECT title,story FROM groups where id='1114'
SELECT id,dirname,fname FROM images where groupid='1114'
SELECT id,dirname,fname,viewno,groupid FROM images where id='10035' limit 0,1
UPDATE images set viewno='1',lastlook=NOW('') where id='10035'
SELECT entry,whoby FROM ucaptions where picid='10035'
SELECT dirname,fname,caption from images where id='10035' limit 0,1
SELECT title,story FROM groups where id='1114'
SELECT id,dirname,fname FROM images where groupid='1114'
-- Regards, Andy Davidson http://www.fotoserve.com/ Great quality prints from digital photos.
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]