Reputation:
Is there a way to set the filter in p6spy, such that it only logs "insert/delete/update" and NOT "select" SQL statements?
Documentation of p6spy mentions: "P6Spy allows you to monitor specific tables or specific statement types"
An example they gave was the following:
An example showing capture of all select statements, except the orders table follows:
filter = true # comma separated list of tables to include include = select # comma separated list of tables to exclude exclude = orders
So I thought, there must be a way to include insert, delete, updates and exclude select... hence, I prepared my properties file like so:
filter = true
# comma separated list of tables to include
include = insert,update,delete
# comma separated list of tables to exclude
exclude = select
but that does not seem to work. Anyone with any suggestions??
Upvotes: 2
Views: 1791
Reputation: 1
exclude sql like select or otherKeyWords:
filter=true
sqlexpression=^(?!.*select)(?!.*otherKeyWords).*$
Upvotes: 0
Reputation: 7847
The definition has changed. In short, you can use what the OP used i.e:
filter=true
# comma separated list of *******STRINGS******* to include
include=insert,update,delete
# comma separated list of *******STRINGS******* to exclude
exclude=select
Or if you want to have more control, you can use sqlexpression like so:
filter=true
sqlexpression=^(.*(from\\scustomers).*)$
Upvotes: 0
Reputation: 2058
The key to the answer is in the comments
# comma separated list of tables to include
include = select
select
is a name of a table, not the type of a statement.
It seems impossible to filter by statement types (at least by select
/update
/delete
) easily. You'll be able to do it by using
# sql expression to evaluate if using regex filtering
sqlexpression=
#allows you to use a regex engine or your own matching engine to determine
#which statements to log
stringmatcher=com.p6spy.engine.common.GnuRegexMatcher
Upvotes: 1