How to trace a query on Firebird? With SQL Server we can trace for a period of time, to get what queries are running.

How can I do this with Firebird? I'm reading something on their website but there's only user trace like if the login failed or not. 

Found something here:

https://stackoverflow.com/questions/30248937/how-to-capture-firebird-sql-queries

Will test it.
Firebird has two distinct options for monitoring:


The monitoring tables, which provide a snapshot of activity on the server. For example MON$STATEMENTS provides the currently running statements. Note that content of monitoring tables are stable within a transaction, so to refresh it, you will have to commit and start a new transaction.
The trace facility, which allows you to get information on activity in a database. It can be either be configured by an administrator to run server side, or users can do limited tracing of their own sessions remotely (users with administrator rights have more access). For details see Trace and Audit Services in the Firebird 2.5 release notes, and the article Audit and Trace Services in Firebird 2.5 by Thomas Steinmaurer.

Tooling included with Firebird is rather basic and low level, and you may want to look at third party tools that simplify access to this trace facility.


In addition, there are tools that act like a proxy for Firebird, allowing you to trace activity that way, for example FBScanner.

See also my answer on How to capture Firebird SQL queries? on Stack Overflow (as you already found).