mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-11 21:51:21 +00:00
Merge fix-genlog-db-bug
This commit is contained in:
@@ -9692,7 +9692,8 @@ sub parse_event {
|
|||||||
$cmd = $arg;
|
$cmd = $arg;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
my ($user, undef, $db) = $arg =~ /(\S+)/g;
|
my ($user) = $arg =~ m/(\S+)/;
|
||||||
|
my ($db) = $arg =~ m/on (\S+)/;
|
||||||
my $host;
|
my $host;
|
||||||
($user, $host) = split(/@/, $user);
|
($user, $host) = split(/@/, $user);
|
||||||
PTDEBUG && _d('Connect', $user, '@', $host, 'on', $db);
|
PTDEBUG && _d('Connect', $user, '@', $host, 'on', $db);
|
||||||
|
@@ -129,7 +129,8 @@ sub parse_event {
|
|||||||
else {
|
else {
|
||||||
# The Connect command may or may not be followed by 'on'.
|
# The Connect command may or may not be followed by 'on'.
|
||||||
# When it is, 'on' may or may not be followed by a database.
|
# When it is, 'on' may or may not be followed by a database.
|
||||||
my ($user, undef, $db) = $arg =~ /(\S+)/g;
|
my ($user) = $arg =~ m/(\S+)/;
|
||||||
|
my ($db) = $arg =~ m/on (\S+)/;
|
||||||
my $host;
|
my $host;
|
||||||
($user, $host) = split(/@/, $user);
|
($user, $host) = split(/@/, $user);
|
||||||
PTDEBUG && _d('Connect', $user, '@', $host, 'on', $db);
|
PTDEBUG && _d('Connect', $user, '@', $host, 'on', $db);
|
||||||
|
@@ -9,7 +9,7 @@ BEGIN {
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings FATAL => 'all';
|
use warnings FATAL => 'all';
|
||||||
use English qw(-no_match_vars);
|
use English qw(-no_match_vars);
|
||||||
use Test::More tests => 7;
|
use Test::More;
|
||||||
|
|
||||||
use GeneralLogParser;
|
use GeneralLogParser;
|
||||||
use PerconaTest;
|
use PerconaTest;
|
||||||
@@ -219,7 +219,58 @@ test_log_parser(
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
# Customer issue from Ernie.
|
||||||
|
test_log_parser(
|
||||||
|
parser => $p,
|
||||||
|
file => $sample.'genlog004.txt',
|
||||||
|
oktorun => sub { $oktorun = $_[0]; },
|
||||||
|
result => [
|
||||||
|
{
|
||||||
|
Query_time => 0,
|
||||||
|
Thread_id => '12345',
|
||||||
|
arg => q/administrator command: Access denied for user 'nobody'@'localhost' (using password: NO)
|
||||||
|
/,
|
||||||
|
bytes => 88,
|
||||||
|
cmd => 'Admin',
|
||||||
|
pos_in_log => 0,
|
||||||
|
ts => undef
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Query_time => 0,
|
||||||
|
Thread_id => '12345',
|
||||||
|
arg => 'administrator command: Connect',
|
||||||
|
bytes => 30,
|
||||||
|
cmd => 'Admin',
|
||||||
|
host => 'localhost',
|
||||||
|
pos_in_log => 81,
|
||||||
|
ts => undef,
|
||||||
|
user => 'nobody'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Query_time => 0,
|
||||||
|
Thread_id => '31519',
|
||||||
|
arg => 'BEGIN',
|
||||||
|
bytes => 5,
|
||||||
|
cmd => 'Query',
|
||||||
|
pos_in_log => 122,
|
||||||
|
ts => undef
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Query_time => 0,
|
||||||
|
Thread_id => '98765',
|
||||||
|
arg => 'administrator command: Connect',
|
||||||
|
bytes => 30,
|
||||||
|
cmd => 'Admin',
|
||||||
|
db => 'sar',
|
||||||
|
host => '1.2.3.4',
|
||||||
|
pos_in_log => 184,
|
||||||
|
ts => undef,
|
||||||
|
user => 'payments_r'
|
||||||
|
},
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
# Done.
|
# Done.
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
exit;
|
done_testing;
|
||||||
|
4
t/lib/samples/genlogs/genlog004.txt
Normal file
4
t/lib/samples/genlogs/genlog004.txt
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
12345 Connect Access denied for user 'nobody'@'localhost' (using password: NO)
|
||||||
|
12345 Connect nobody@localhost as on
|
||||||
|
31519 Query BEGIN
|
||||||
|
98765 Connect payments_r@1.2.3.4 on sar
|
Reference in New Issue
Block a user