views:

158

answers:

1

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??

A: 

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
dm3