44
44
my $slow_log_ts_line = qr/^# Time: ([0-9: ]{15})/;
45
my $slow_log_uh_line = qr/# User\@Host: ([^\[]+|\[[^[]+\]).*?@ (\S*) \[(.*)\]/;
45
my $slow_log_uh_line = qr/# User\@Host: ([^\[]+|\[[^[]+\]).*?@ (\S*) \[(.*)\]\s*(?:Id:\s*(\d+))?/;
46
46
# These can appear in the log file when it's opened -- for example, when someone
47
47
# runs FLUSH LOGS or the server starts.
48
48
# /usr/sbin/mysqld, Version: 5.0.67-0ubuntu6-log ((Ubuntu)). started with:
160
160
# The User@Host might be concatenated onto the end of the Time.
162
&& ( my ( $user, $host, $ip ) = $line =~ m/$slow_log_uh_line/o )
162
&& ( my ( $user, $host, $ip, $thread_id ) = $line =~ m/$slow_log_uh_line/o )
164
164
PTDEBUG && _d("Got user, host, ip", $user, $host, $ip);
165
165
push @properties, 'user', $user, 'host', $host, 'ip', $ip;
166
# 5.6 has the thread id on the User@Host line
168
push @properties, 'Thread_id', $thread_id;
170
174
# Maybe it's the user/host line of a slow query log
171
175
# # User@Host: root[root] @ localhost []
173
&& ( my ( $user, $host, $ip ) = $line =~ m/$slow_log_uh_line/o )
177
&& ( my ( $user, $host, $ip, $thread_id ) = $line =~ m/$slow_log_uh_line/o )
175
PTDEBUG && _d("Got user, host, ip", $user, $host, $ip);
176
push @properties, 'user', $user, 'host', $host, 'ip', $ip;
179
PTDEBUG && _d("Got user, host, ip", $user, $host, $ip);
180
push @properties, 'user', $user, 'host', $host, 'ip', $ip;
181
# 5.6 has the thread id on the User@Host line
183
push @properties, 'Thread_id', $thread_id;