Trying to isolate pt-query-digest per host
Asked Answered
T

1

6

I'm having some difficulty coming up with correct syntax to pull in specific host information for my slow query log file:

I'm using the following:

sudo pt-query-digest mysql-slow.log --since "2017-05-07 22:00:00" --until "2017-05-08 22:00:00" --filter ‘$event->{host} !~ m/^ip-1-1-1-1/’ > slow.log

In this scenario I'm trying to exclude all IPs that are 1.1.1.1. I can't figure out what's wrong.

Thorvaldsen answered 8/5, 2017 at 23:31 Comment(2)
The primary problem is with shell-processing, so I added a tag.Orme
Shouldn't the pattern be m/^1\.1\.1\.1$/?Skelp
O
2

Use ascii quote ('), not this non-ascii quote (‘);

Assuming that m/^ip-1-1-1-1/ works, it will catch both ip-1-1-1-1 and ip-1-1-1-123. So you may need something to terminate the ip. Perhaps m/^ip-1-1-1-1$/

Without hiding the arg in single-quotes, the shell is interpreting (at least) $event as a shell variable, {...} as something, and !~ as something.

Orme answered 23/5, 2017 at 21:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.