firebird
firebird copied to clipboard
Provide ability to see info about application that make connect to Services API
- create following config for TRACE:
database = (%[\\/](security[[:DIGIT:]]).fdb|(security.db))
{
enabled = false
}
database
{
enabled = true
log_initfini = false
log_errors = true
log_connections = true
}
services
{
enabled = true
#include_filter = Database Properties
exclude_filter = "Start Trace Session"
log_services = true
log_initfini = false
}
- run trace
- make sure that firebird have access rights to C:\TEMP\ and there are variables ISC_USER & ISC_PASSWORD
- run command (change path to your actual %FB_HOME%):
( (if exist C:\TEMP\TMP4TEST.FDB del C:\TEMP\TMP4TEST.FDB 2>nul) && echo create database 'localhost:C:\TEMP\tmp4test.fdb'; | D:\FB\fb308\isql -q ) && D:\FB\fb308\fbsvcmgr localhost:service_mgr action_properties dbname C:\TEMP\TMP4TEST.FDB prp_write_mode prp_wm_async
Trace log will be like this:
Trace session ID 1 started
2022-04-29T18:45:33.1450 (13096:00000000011B0640) CREATE_DATABASE
C:\TEMP\TMP4TEST.FDB (ATT_3, SYSDBA:NONE, NONE, TCPv6:::1/55484)
D:\FB\fb308\isql.exe:9220
2022-04-29T18:45:33.1450 (13096:00000000011B0640) DETACH_DATABASE
C:\TEMP\TMP4TEST.FDB (ATT_3, SYSDBA:NONE, NONE, TCPv6:::1/55484)
D:\FB\fb308\isql.exe:9220
2022-04-29T18:45:33.2300 (13096:00000000011B0640) ATTACH_SERVICE
service_mgr, (Service 0000000039987640, SYSDBA, TCPv6:::1/55485, D:\FB\fb308\fbsvcmgr.exe:11208)
2022-04-29T18:45:33.2820 (13096:00000000011B17C0) ATTACH_DATABASE ------------------ [ 1 ]
C:\TEMP\TMP4TEST.FDB (ATT_6, SYSDBA:NONE, NONE, TCPv6:::1/55485)
2022-04-29T18:45:33.2820 (13096:00000000011B17C0) DETACH_DATABASE ------------------ [ 2 ]
C:\TEMP\TMP4TEST.FDB (ATT_6, SYSDBA:NONE, NONE, TCPv6:::1/55485)
2022-04-29T18:45:33.3290 (13096:00000000011B0640) START_SERVICE
service_mgr, (Service 0000000039987640, SYSDBA, TCPv6:::1/55485, D:\FB\fb308\fbsvcmgr.exe:11208)
"Database Properties"
C:\TEMP\TMP4TEST.FDB -WRITE ASYNC
2022-04-29T18:45:33.3290 (13096:00000000011B0640) DETACH_SERVICE
service_mgr, (Service 0000000039987640, SYSDBA, TCPv6:::1/55485, D:\FB\fb308\fbsvcmgr.exe:11208)
Note that ATTACH / DETACH database blocks marked as [1] and [2] have no info about application. But for current trace config it is not a problem to find 'author' of such connection (service_mgr) and what it performed ("-WRITE ASYNC").
It will be good if such info will be avaliable without need to include 'services' section to the trace config and turning it on (with probably adding include/exclude filter etc).
For example, ATTACH_DATABASE could look like this:
2022-04-29T18:45:33.2820 (13096:00000000011B17C0) ATTACH_DATABASE
C:\TEMP\TMP4TEST.FDB (ATT_6, SYSDBA:NONE, NONE, TCPv6:::1/55485, service_mgr, "Database Properties")
D:\FB\fb308\isql.exe:9220