Metabase log each query

Hi,

Team is there a way we can log each query executed in the metabase? If yes, can you please let me know, how can we enable this?

Regards,

Nitikesh Bhavsar

What specific information about the query are you attempting to log? The application currently records the basic state of each query that gets executed and by whom, but we do not store any of the results of the query.

Note that this information is not surfaced anywhere in the application UI at the moment.

Hello,

Can you specify how can I get the info of who is making a query in the log? Currently I am only able to see the timestamp of the query and the query itself, but it seems Metabase is not logging the name or email of whoever performed the query:

04-12 23:02:19 ^[[1mDEBUG driver.query-processor^[[0m :: ^[[34m QUERY: 😎 {:database 2, :type "native", :native {:query " SELECT DATE(XYZ) as x,y,count(*)\n FROM x\n INNER JOIN y on barf = biff\n WHERE DATE(borf) > '2016-04-08' and burf = false and barf not in ('foo','baz', 'bar') group by barf, DATE(birf) order by borf;"}, :constraints {:max-results 10000, :max-results-bare-rows 2000}} ^[[0m

This is actually in our 0.18 release which will be out this afternoon!

Thanks, I just installed the 0.18 release. I can see :info {:executed-by 58, . That should work but I am not sure of how to relate the user id to the actual user.

How could I do this?

I think you will need to look at the user table of the application database.

It’s expected that if you’re debugging SQL you’ll be pretty sophisticated. Do you have H2 or a MySQL/PostgreSQL box running?

What we do is point Metabase itself (usually a non-production instance or a developers personal Mac app) to the application database itself and lookup the user by id.

Hello,

Yeah, I have no problem looking at the database directly. I think I am using H2… I am using the default stuff that is generated by running java --server --jar metabase.jar And this generates the h2 files.

Thanks a lot

I am running latest version of metabase, I am not able to see below prepend data
in any query(select * from query).Could anyone help me where this prepend data is stored for each query?

– Metabase:: userID: 2 executionID: 170cbab5-090b-4be5-b286-1168f9439b5a queryType: MBQL queryHash: 1005045833

Is there a FLAG or some settings, We have to modify?
Thanks