SlideShare une entreprise Scribd logo
1  sur  30
Télécharger pour lire hors ligne
Continuous Database Monitoring with the
     Trace API
     Firebird Conference 2011 – Luxembourg
     25.11.2011 – 26.11.2011
     Thomas Steinmaurer DI

     +43 7236 3343 896
     thomas.steinmaurer@scch.at t.steinmaurer@upscene.com
     www.scch.at                www.upscene.com
                                http://blog.upscene.com/thomas/



The SCCH is an initiative of                                      The SCCH is located at
Agenda


       Motivation
       Monitoring Approaches
       Firebird 2.5 Audit and Trace Services
       Usage of fbtracemgr
       FB TraceManager 2
       Q&A




© Software Competence Center Hagenberg GmbH    2
Motivation


       Several stakeholders for database monitoring
             Administrators
             Developers
             Auditors
             ...
       A snapshot (MON$) of current activities is interesting. But,
       most of the time you need the history of executed events
       Continuous monitoring gives you a stream of executed
       events over a period of time and lets you look back
       A new way to detect and diagnose problems
       The Audit and Trace Services API in Firebird 2.5
       provides that!!!
© Software Competence Center Hagenberg GmbH                           3
Motivation


       Typical use cases for the Audit and Trace Services API
             Number of executed statements for a particular time period
                  Usage statistics for load planning
             Block-box debugging
                  Execution trace for an in-house / third-party product
                  For third-party products, usually you don‘t have access to the
                  client source code
                  No need for adding trace logic into the client application
             Detection of
                  Failed / Unauthorized access
                  Certain event types
                  Improper client transaction management (e.g. Regular usage of
                  COMMIT RETAINING)
                  Full table scans

© Software Competence Center Hagenberg GmbH                                        4
Motivation


       Typical use cases for the Audit and Trace Services API
             Detection of (continued)
                  Most-Frequently executed statements
                  Worst-Performing executed statements
                  Executed statements which are slower than a given threshold
                  (e.g. 5 seconds)
             Statistics
                  Number of statements per IP / process name / user ...
                  Most loaded database on the server
                  When are usual peak loads
                  ...
             Generated trace as input for a security audit
             AND MORE ... !!!
© Software Competence Center Hagenberg GmbH                                     5
Motivation




                       Quick Start Demonstration




© Software Competence Center Hagenberg GmbH        6
Agenda


       Motivation
       Monitoring Approaches
       Firebird 2.5 Audit and Trace Services
       Usage of fbtracemgr
       FB TraceManager 2
       Q&A




© Software Competence Center Hagenberg GmbH    7
Monitoring Approaches


       Basic monitoring requirements
             Continuous
             Server-side
             Configurable
       Three out-of-the box monitoring approaches in Firebird 2.5
             Trigger-based (since Firebird 1.0)
             Monitoring tables (since Firebird 2.1)
             Audit and Trace Services (since Firebird 2.5)
       Based on your monitoring requirements, you possibly will
       have/use a mix of these approaches



© Software Competence Center Hagenberg GmbH                         8
Monitoring Approaches
 Comparison

                                                              Monitoring   Audit/Trace
                                              Trigger-based
                                                               tables       Services
    Available since Firebird
                                                   1.0           2.1          2.5
    version

    Continuous                                    Yes            No           Yes

    Serverside                                    Yes            Yes          Yes

    Configurable                                  Yes            No           Yes

    Monitoring of SELECT                           No            Yes          Yes

    Monitoring of DELETE,
                                                  Yes            Yes          Yes
    INSERT, UPDATE

© Software Competence Center Hagenberg GmbH                                              9
Monitoring Approaches
 Comparison

                                                              Monitoring   Audit/Trace
                                              Trigger-based
                                                               tables       Services
    Access to old/new
    column values for
                                                  Yes            No            No
    DELETE, INSERT,
    UPDATE
    Access to statement
                                                   No            No           Yes
    execution time
    Access to statement
                                                   No            No           Yes
    execution plan
    Monitoring of database-                       Partly
    wide operations like                       (database
                                                                Partly        Yes
    connect, disconnect,                       triggers in
    transaction start etc.                    Firebird 2.1)

© Software Competence Center Hagenberg GmbH                                              10
Agenda


       Motivation
       Monitoring Approaches
       Firebird 2.5 Audit and Trace Services
       Usage of fbtracemgr
       FB TraceManager 2
       Q&A




© Software Competence Center Hagenberg GmbH    11
Audit and Trace Services
 General

       New feature in Firebird 2.5 across all architectures and
       supported platforms
       Allows to produce a trace of events in chronological
       sequence
       Event types
             Database-specific
                  Connect, Disconnect
                  Start/Commit/Rollback of transactions
                  Prepare/Start/Finish/Free of SQL statements
                  Start/Finish of stored procedures and triggers
                  etc.
             Server-wide
                  Services API requests (e.g. backup, restore, get server log etc.)


© Software Competence Center Hagenberg GmbH                                           12
Audit and Trace Services
 System Audit vs. User Trace

       System Audit
             Will be started by the engine upon Firebird server start
             Stores trace output in a text file on the server
             Is activated by setting the new AuditTraceConfigFile
             parameter (= path to the trace configuration file) in
             firebird.conf
             There can be only one system audit per Firebird instance
       User Trace
             Needs to be started by a user manually
             Trace output is read by the initiating application fetching trace
             data via the Services API
             Needs to be re-started after a server crash/restart
             There can be several user traces per Firebird instance

© Software Competence Center Hagenberg GmbH                                      13
Audit and Trace Services
 Trace Output

       Implemented by the pre-installed fbtrace(.dll|.so) plugin
   Trace session ID 1 started
   2010-11-10T22:26:00.4160 (1368:0000000000F1DC88) TRACE_INIT
      SESSION_1 FBTM - tourism


   2010-11-10T22:26:00.4160 (1368:0000000000F1DC88) ATTACH_DATABASE
      tourism.fdb (ATT_1415, TOURISM:NONE, NONE, TCPv4:127.0.0.1)
      C:Program Files (x86)Upscene ProductionsDatabase Workbench 4
      ProDBW4.exe:3768

   2010-11-10T22:26:00.4220 (1368:0000000000F1DC88) START_TRANSACTION
      tourism.fdb (ATT_1415, TOURISM:NONE, NONE, TCPv4:127.0.0.1)
      C:Program Files (x86)Upscene ProductionsDatabase Workbench 4
      ProDBW4.exe:3768
            (TRA_24395, READ_COMMITTED | REC_VERSION | NOWAIT | READ_WRITE)

   2010-11-10T22:26:00.4860 (1368:0000000000F1DC88) PREPARE_STATEMENT
      tourism.fdb (ATT_1415, TOURISM:NONE, NONE, TCPv4:127.0.0.1)
      C:Program Files (x86)Upscene ProductionsDatabase Workbench 4
      ProDBW4.exe:3768
            (TRA_24395, READ_COMMITTED | REC_VERSION | NOWAIT | READ_WRITE)


© Software Competence Center Hagenberg GmbH                                   14
Audit and Trace Services
 Trace Configuration

       A system audit / user trace is configurable by providing a
       mandatory trace configuration (file)
       Customization of
             Database-wide events
                  Connect, disconnect, prepare statement etc.
             Server-wide events
                  Services API requests
       Consists of
             Default <database> section
             <database db_name_pattern> section per database
             Max. one <services> section for server-wide events
       Pre-installed fbtrace.conf is a good start for writing your
       own trace configuration

© Software Competence Center Hagenberg GmbH                          15
Audit and Trace Services
 Trace Configuration

       A very simple example
   <database>
      enabled true
   </database>

   <database employee.fdb>
      enabled false
      log_connections true
      log_transactions true
   </database>

   <database tourism.fdb>
      log_connections true
   </database>




© Software Competence Center Hagenberg GmbH   16
Audit and Trace Services
 Trace Configuration

       <database> configuration parameters
             enabled, log_filename, max_log_size, include_filter,
             exclude_filter, log_connections, connection_id,
             log_transactions, log_statement_prepare,
             log_statement_free, log_statement_start,
             log_statement_finish, log_procedure_start,
             log_procedure_finish, log_trigger_start, log_trigger_finish,
             log_context, print_plan, print_perf, log_blr_requests,
             print_blr, log_dyn_requests, print_dyn, time_threshold,
             max_sql_length, max_blr_length, max_dyn_length,
             max_arg_length, max_arg_count
       <services> configuration parameters
             enabled, log_filename, max_log_size, include_filter,
             exclude_filter, log_services, log_service_query


© Software Competence Center Hagenberg GmbH                                 17
Audit and Trace Services
 Manage Trace Sessions

       Trace Sessions can be managed via new Services API calls
           Action                             Services API call

           Start a new user trace session isc_action_svc_trace_start


           Stop a trace session               isc_action_svc_trace_stop


           Suspend a trace session            isc_action_svc_trace_suspend


           Resume a trace session             isc_action_svc_trace_resume


           List all trace sessions            isc_action_svc_trace_list

© Software Competence Center Hagenberg GmbH                                  18
Audit and Trace Services
 Security

       Every user can start a trace session
       Used user name upon attaching to the services manager defines
           Privileges in respect to managing other trace sessions
           Visibility of traceable statements
       Privileges
           SYSDBA can manage all other trace sessions including a system
           audit
           Non-SYSDBA users can manage their own trace sessions only
       Visibility
           A user trace session started by SYSDBA logs activities of all
           users/connections
           A user trace session started by a non-SYSDBA user logs only its
           own activities


© Software Competence Center Hagenberg GmbH                                  19
Agenda


       Motivation
       Monitoring Approaches
       Firebird 2.5 Audit and Trace Services
       Usage of fbtracemgr
       FB TraceManager 2
       Q&A




© Software Competence Center Hagenberg GmbH    20
Usage of fbtracemgr




© Software Competence Center Hagenberg GmbH   21
Usage of fbtracemgr




                                 Live Demonstration




© Software Competence Center Hagenberg GmbH           22
Agenda


       Motivation
       Monitoring Approaches
       Firebird 2.5 Audit and Trace Services
       Usage of fbtracemgr
       FB TraceManager 2
       Q&A




© Software Competence Center Hagenberg GmbH    23
FB TraceManager 2




© Software Competence Center Hagenberg GmbH   24
FB TraceManager 2




                                 Live Demonstration




© Software Competence Center Hagenberg GmbH           25
FB TraceManager 2
 Editions

       Lite Edition
             Local connections and raw trace data only
             Freely available
       Standard Edition
             Lite + Remote connections, Parser, Reporting
             99 EUR per user named license
       Enterprise Edition
             Standard + Analysis, Event Processing
             149 EUR per user named license
       Trial Edition
             30 days limited Enterprise Edition
             Limited number of received/parsed trace events


© Software Competence Center Hagenberg GmbH                   26
Agenda


       Motivation
       Monitoring Approaches
       Firebird 2.5 Audit and Trace Services
       Usage of fbtracemgr
       FB TraceManager 2
       Q&A




© Software Competence Center Hagenberg GmbH    27
Q&A




                           Questions and Answers




© Software Competence Center Hagenberg GmbH        28
The End




                         Thanks for your attention!

                                     thomas.steinmaurer@scch.at
                                     t.steinmaurer@upscene.com
                                    http://blog.upscene.com/thomas




© Software Competence Center Hagenberg GmbH                          29
Resources


       Firebird 2.5 Release Notes:
       http://www.firebirdsql.org/devel/doc/rlsnotes/html/rlsnotes2
       5.html
       Trace Services and Audit in Firebird 2.5, by Vlad Khorsun;
       Firebird Conference 2009 Munich
       Audit and Trace Services in Firebird 2.5, by Thomas
       Steinmaurer, 2010:
       http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp
       _audit_trace_steinmaurer
       FB TraceManager 2: http://www.upscene.com/go/?go=fbtm



© Software Competence Center Hagenberg GmbH                           30

Contenu connexe

Similaire à Continuous Database Monitoring with the Trace API

06 operations and feedback dap-kabel
06   operations and feedback dap-kabel06   operations and feedback dap-kabel
06 operations and feedback dap-kabel
David Alvarez Palomo
 

Similaire à Continuous Database Monitoring with the Trace API (20)

Safeguarding Your SAP System Availability And Performance
Safeguarding Your SAP System Availability And PerformanceSafeguarding Your SAP System Availability And Performance
Safeguarding Your SAP System Availability And Performance
 
DevOps (2).pptx
DevOps (2).pptxDevOps (2).pptx
DevOps (2).pptx
 
Dot Net Application Monitoring
Dot Net Application MonitoringDot Net Application Monitoring
Dot Net Application Monitoring
 
Continuous Profiling in Production: What, Why and How
Continuous Profiling in Production: What, Why and HowContinuous Profiling in Production: What, Why and How
Continuous Profiling in Production: What, Why and How
 
Rv11
Rv11Rv11
Rv11
 
3158 - Cloud Infrastructure & It Optimization - Application Performance Manag...
3158 - Cloud Infrastructure & It Optimization - Application Performance Manag...3158 - Cloud Infrastructure & It Optimization - Application Performance Manag...
3158 - Cloud Infrastructure & It Optimization - Application Performance Manag...
 
NashTech - Azure Application Insights
NashTech - Azure Application InsightsNashTech - Azure Application Insights
NashTech - Azure Application Insights
 
Api gitlab: configurazione dei progetti as a service
Api gitlab: configurazione dei progetti as a serviceApi gitlab: configurazione dei progetti as a service
Api gitlab: configurazione dei progetti as a service
 
MuleSoft Surat Virtual Meetup#4 - Anypoint Monitoring and MuleSoft dataloader.io
MuleSoft Surat Virtual Meetup#4 - Anypoint Monitoring and MuleSoft dataloader.ioMuleSoft Surat Virtual Meetup#4 - Anypoint Monitoring and MuleSoft dataloader.io
MuleSoft Surat Virtual Meetup#4 - Anypoint Monitoring and MuleSoft dataloader.io
 
Platform Observability and Infrastructure Closed Loops
Platform Observability and Infrastructure Closed LoopsPlatform Observability and Infrastructure Closed Loops
Platform Observability and Infrastructure Closed Loops
 
How to Build a DevOps Toolchain
How to Build a DevOps ToolchainHow to Build a DevOps Toolchain
How to Build a DevOps Toolchain
 
SCOM Tips and Tricks
SCOM Tips and TricksSCOM Tips and Tricks
SCOM Tips and Tricks
 
Production profiling what, why and how technical audience (3)
Production profiling  what, why and how   technical audience (3)Production profiling  what, why and how   technical audience (3)
Production profiling what, why and how technical audience (3)
 
T3 Consortium's Performance Center of Excellence
T3 Consortium's Performance Center of ExcellenceT3 Consortium's Performance Center of Excellence
T3 Consortium's Performance Center of Excellence
 
WATS 2014 WA Agents Overview - CA Workload Automation Technology Summit (WATS...
WATS 2014 WA Agents Overview - CA Workload Automation Technology Summit (WATS...WATS 2014 WA Agents Overview - CA Workload Automation Technology Summit (WATS...
WATS 2014 WA Agents Overview - CA Workload Automation Technology Summit (WATS...
 
Benchmarking PyCon AU 2011 v0
Benchmarking PyCon AU 2011 v0Benchmarking PyCon AU 2011 v0
Benchmarking PyCon AU 2011 v0
 
Kscope presentation 2013
Kscope presentation 2013Kscope presentation 2013
Kscope presentation 2013
 
To Scale Test Automation for DevOps, Avoid These Anti-Patterns
To Scale Test Automation for DevOps, Avoid These Anti-PatternsTo Scale Test Automation for DevOps, Avoid These Anti-Patterns
To Scale Test Automation for DevOps, Avoid These Anti-Patterns
 
06 operations and feedback dap-kabel
06   operations and feedback dap-kabel06   operations and feedback dap-kabel
06 operations and feedback dap-kabel
 
Mastering DevOps-Driven Data Integration with FME
Mastering DevOps-Driven Data Integration with FMEMastering DevOps-Driven Data Integration with FME
Mastering DevOps-Driven Data Integration with FME
 

Plus de Mind The Firebird

Tips for using Firebird system tables
Tips for using Firebird system tablesTips for using Firebird system tables
Tips for using Firebird system tables
Mind The Firebird
 
A year in the life of Firebird .Net provider
A year in the life of Firebird .Net providerA year in the life of Firebird .Net provider
A year in the life of Firebird .Net provider
Mind The Firebird
 
How Firebird transactions work
How Firebird transactions workHow Firebird transactions work
How Firebird transactions work
Mind The Firebird
 
Orphans, Corruption, Careful Write, and Logging
Orphans, Corruption, Careful Write, and LoggingOrphans, Corruption, Careful Write, and Logging
Orphans, Corruption, Careful Write, and Logging
Mind The Firebird
 

Plus de Mind The Firebird (20)

Tips for using Firebird system tables
Tips for using Firebird system tablesTips for using Firebird system tables
Tips for using Firebird system tables
 
Using Azure cloud and Firebird to develop applications easily
Using Azure cloud and Firebird to develop applications easilyUsing Azure cloud and Firebird to develop applications easily
Using Azure cloud and Firebird to develop applications easily
 
A year in the life of Firebird .Net provider
A year in the life of Firebird .Net providerA year in the life of Firebird .Net provider
A year in the life of Firebird .Net provider
 
How Firebird transactions work
How Firebird transactions workHow Firebird transactions work
How Firebird transactions work
 
SuperServer in Firebird 3
SuperServer in Firebird 3SuperServer in Firebird 3
SuperServer in Firebird 3
 
Copycat presentation
Copycat presentationCopycat presentation
Copycat presentation
 
Using ТРСС to study Firebird performance
Using ТРСС to study Firebird performanceUsing ТРСС to study Firebird performance
Using ТРСС to study Firebird performance
 
Overview of RedDatabase 2.5
Overview of RedDatabase 2.5Overview of RedDatabase 2.5
Overview of RedDatabase 2.5
 
Creating logs for data auditing in FirebirdSQL
Creating logs for data auditing in FirebirdSQLCreating logs for data auditing in FirebirdSQL
Creating logs for data auditing in FirebirdSQL
 
Firebird Performance counters in details
Firebird Performance counters in detailsFirebird Performance counters in details
Firebird Performance counters in details
 
Understanding Numbers in Firebird SQL
Understanding Numbers in Firebird SQLUnderstanding Numbers in Firebird SQL
Understanding Numbers in Firebird SQL
 
Threading through InterBase, Firebird, and beyond
Threading through InterBase, Firebird, and beyondThreading through InterBase, Firebird, and beyond
Threading through InterBase, Firebird, and beyond
 
New SQL Features in Firebird 3, by Vlad Khorsun
New SQL Features in Firebird 3, by Vlad KhorsunNew SQL Features in Firebird 3, by Vlad Khorsun
New SQL Features in Firebird 3, by Vlad Khorsun
 
Orphans, Corruption, Careful Write, and Logging
Orphans, Corruption, Careful Write, and LoggingOrphans, Corruption, Careful Write, and Logging
Orphans, Corruption, Careful Write, and Logging
 
Firebird release strategy and roadmap for 2015/2016
Firebird release strategy and roadmap for 2015/2016Firebird release strategy and roadmap for 2015/2016
Firebird release strategy and roadmap for 2015/2016
 
Nbackup and Backup: Internals, Usage strategy and Pitfalls, by Dmitry Kuzmenk...
Nbackup and Backup: Internals, Usage strategy and Pitfalls, by Dmitry Kuzmenk...Nbackup and Backup: Internals, Usage strategy and Pitfalls, by Dmitry Kuzmenk...
Nbackup and Backup: Internals, Usage strategy and Pitfalls, by Dmitry Kuzmenk...
 
Working with Large Firebird databases
Working with Large Firebird databasesWorking with Large Firebird databases
Working with Large Firebird databases
 
Stored procedures in Firebird
Stored procedures in FirebirdStored procedures in Firebird
Stored procedures in Firebird
 
Firebird on Linux
Firebird on LinuxFirebird on Linux
Firebird on Linux
 
Superchaging big production systems on Firebird: transactions, garbage, maint...
Superchaging big production systems on Firebird: transactions, garbage, maint...Superchaging big production systems on Firebird: transactions, garbage, maint...
Superchaging big production systems on Firebird: transactions, garbage, maint...
 

Dernier

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Dernier (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 

Continuous Database Monitoring with the Trace API

  • 1. Continuous Database Monitoring with the Trace API Firebird Conference 2011 – Luxembourg 25.11.2011 – 26.11.2011 Thomas Steinmaurer DI +43 7236 3343 896 thomas.steinmaurer@scch.at t.steinmaurer@upscene.com www.scch.at www.upscene.com http://blog.upscene.com/thomas/ The SCCH is an initiative of The SCCH is located at
  • 2. Agenda Motivation Monitoring Approaches Firebird 2.5 Audit and Trace Services Usage of fbtracemgr FB TraceManager 2 Q&A © Software Competence Center Hagenberg GmbH 2
  • 3. Motivation Several stakeholders for database monitoring Administrators Developers Auditors ... A snapshot (MON$) of current activities is interesting. But, most of the time you need the history of executed events Continuous monitoring gives you a stream of executed events over a period of time and lets you look back A new way to detect and diagnose problems The Audit and Trace Services API in Firebird 2.5 provides that!!! © Software Competence Center Hagenberg GmbH 3
  • 4. Motivation Typical use cases for the Audit and Trace Services API Number of executed statements for a particular time period Usage statistics for load planning Block-box debugging Execution trace for an in-house / third-party product For third-party products, usually you don‘t have access to the client source code No need for adding trace logic into the client application Detection of Failed / Unauthorized access Certain event types Improper client transaction management (e.g. Regular usage of COMMIT RETAINING) Full table scans © Software Competence Center Hagenberg GmbH 4
  • 5. Motivation Typical use cases for the Audit and Trace Services API Detection of (continued) Most-Frequently executed statements Worst-Performing executed statements Executed statements which are slower than a given threshold (e.g. 5 seconds) Statistics Number of statements per IP / process name / user ... Most loaded database on the server When are usual peak loads ... Generated trace as input for a security audit AND MORE ... !!! © Software Competence Center Hagenberg GmbH 5
  • 6. Motivation Quick Start Demonstration © Software Competence Center Hagenberg GmbH 6
  • 7. Agenda Motivation Monitoring Approaches Firebird 2.5 Audit and Trace Services Usage of fbtracemgr FB TraceManager 2 Q&A © Software Competence Center Hagenberg GmbH 7
  • 8. Monitoring Approaches Basic monitoring requirements Continuous Server-side Configurable Three out-of-the box monitoring approaches in Firebird 2.5 Trigger-based (since Firebird 1.0) Monitoring tables (since Firebird 2.1) Audit and Trace Services (since Firebird 2.5) Based on your monitoring requirements, you possibly will have/use a mix of these approaches © Software Competence Center Hagenberg GmbH 8
  • 9. Monitoring Approaches Comparison Monitoring Audit/Trace Trigger-based tables Services Available since Firebird 1.0 2.1 2.5 version Continuous Yes No Yes Serverside Yes Yes Yes Configurable Yes No Yes Monitoring of SELECT No Yes Yes Monitoring of DELETE, Yes Yes Yes INSERT, UPDATE © Software Competence Center Hagenberg GmbH 9
  • 10. Monitoring Approaches Comparison Monitoring Audit/Trace Trigger-based tables Services Access to old/new column values for Yes No No DELETE, INSERT, UPDATE Access to statement No No Yes execution time Access to statement No No Yes execution plan Monitoring of database- Partly wide operations like (database Partly Yes connect, disconnect, triggers in transaction start etc. Firebird 2.1) © Software Competence Center Hagenberg GmbH 10
  • 11. Agenda Motivation Monitoring Approaches Firebird 2.5 Audit and Trace Services Usage of fbtracemgr FB TraceManager 2 Q&A © Software Competence Center Hagenberg GmbH 11
  • 12. Audit and Trace Services General New feature in Firebird 2.5 across all architectures and supported platforms Allows to produce a trace of events in chronological sequence Event types Database-specific Connect, Disconnect Start/Commit/Rollback of transactions Prepare/Start/Finish/Free of SQL statements Start/Finish of stored procedures and triggers etc. Server-wide Services API requests (e.g. backup, restore, get server log etc.) © Software Competence Center Hagenberg GmbH 12
  • 13. Audit and Trace Services System Audit vs. User Trace System Audit Will be started by the engine upon Firebird server start Stores trace output in a text file on the server Is activated by setting the new AuditTraceConfigFile parameter (= path to the trace configuration file) in firebird.conf There can be only one system audit per Firebird instance User Trace Needs to be started by a user manually Trace output is read by the initiating application fetching trace data via the Services API Needs to be re-started after a server crash/restart There can be several user traces per Firebird instance © Software Competence Center Hagenberg GmbH 13
  • 14. Audit and Trace Services Trace Output Implemented by the pre-installed fbtrace(.dll|.so) plugin Trace session ID 1 started 2010-11-10T22:26:00.4160 (1368:0000000000F1DC88) TRACE_INIT SESSION_1 FBTM - tourism 2010-11-10T22:26:00.4160 (1368:0000000000F1DC88) ATTACH_DATABASE tourism.fdb (ATT_1415, TOURISM:NONE, NONE, TCPv4:127.0.0.1) C:Program Files (x86)Upscene ProductionsDatabase Workbench 4 ProDBW4.exe:3768 2010-11-10T22:26:00.4220 (1368:0000000000F1DC88) START_TRANSACTION tourism.fdb (ATT_1415, TOURISM:NONE, NONE, TCPv4:127.0.0.1) C:Program Files (x86)Upscene ProductionsDatabase Workbench 4 ProDBW4.exe:3768 (TRA_24395, READ_COMMITTED | REC_VERSION | NOWAIT | READ_WRITE) 2010-11-10T22:26:00.4860 (1368:0000000000F1DC88) PREPARE_STATEMENT tourism.fdb (ATT_1415, TOURISM:NONE, NONE, TCPv4:127.0.0.1) C:Program Files (x86)Upscene ProductionsDatabase Workbench 4 ProDBW4.exe:3768 (TRA_24395, READ_COMMITTED | REC_VERSION | NOWAIT | READ_WRITE) © Software Competence Center Hagenberg GmbH 14
  • 15. Audit and Trace Services Trace Configuration A system audit / user trace is configurable by providing a mandatory trace configuration (file) Customization of Database-wide events Connect, disconnect, prepare statement etc. Server-wide events Services API requests Consists of Default <database> section <database db_name_pattern> section per database Max. one <services> section for server-wide events Pre-installed fbtrace.conf is a good start for writing your own trace configuration © Software Competence Center Hagenberg GmbH 15
  • 16. Audit and Trace Services Trace Configuration A very simple example <database> enabled true </database> <database employee.fdb> enabled false log_connections true log_transactions true </database> <database tourism.fdb> log_connections true </database> © Software Competence Center Hagenberg GmbH 16
  • 17. Audit and Trace Services Trace Configuration <database> configuration parameters enabled, log_filename, max_log_size, include_filter, exclude_filter, log_connections, connection_id, log_transactions, log_statement_prepare, log_statement_free, log_statement_start, log_statement_finish, log_procedure_start, log_procedure_finish, log_trigger_start, log_trigger_finish, log_context, print_plan, print_perf, log_blr_requests, print_blr, log_dyn_requests, print_dyn, time_threshold, max_sql_length, max_blr_length, max_dyn_length, max_arg_length, max_arg_count <services> configuration parameters enabled, log_filename, max_log_size, include_filter, exclude_filter, log_services, log_service_query © Software Competence Center Hagenberg GmbH 17
  • 18. Audit and Trace Services Manage Trace Sessions Trace Sessions can be managed via new Services API calls Action Services API call Start a new user trace session isc_action_svc_trace_start Stop a trace session isc_action_svc_trace_stop Suspend a trace session isc_action_svc_trace_suspend Resume a trace session isc_action_svc_trace_resume List all trace sessions isc_action_svc_trace_list © Software Competence Center Hagenberg GmbH 18
  • 19. Audit and Trace Services Security Every user can start a trace session Used user name upon attaching to the services manager defines Privileges in respect to managing other trace sessions Visibility of traceable statements Privileges SYSDBA can manage all other trace sessions including a system audit Non-SYSDBA users can manage their own trace sessions only Visibility A user trace session started by SYSDBA logs activities of all users/connections A user trace session started by a non-SYSDBA user logs only its own activities © Software Competence Center Hagenberg GmbH 19
  • 20. Agenda Motivation Monitoring Approaches Firebird 2.5 Audit and Trace Services Usage of fbtracemgr FB TraceManager 2 Q&A © Software Competence Center Hagenberg GmbH 20
  • 21. Usage of fbtracemgr © Software Competence Center Hagenberg GmbH 21
  • 22. Usage of fbtracemgr Live Demonstration © Software Competence Center Hagenberg GmbH 22
  • 23. Agenda Motivation Monitoring Approaches Firebird 2.5 Audit and Trace Services Usage of fbtracemgr FB TraceManager 2 Q&A © Software Competence Center Hagenberg GmbH 23
  • 24. FB TraceManager 2 © Software Competence Center Hagenberg GmbH 24
  • 25. FB TraceManager 2 Live Demonstration © Software Competence Center Hagenberg GmbH 25
  • 26. FB TraceManager 2 Editions Lite Edition Local connections and raw trace data only Freely available Standard Edition Lite + Remote connections, Parser, Reporting 99 EUR per user named license Enterprise Edition Standard + Analysis, Event Processing 149 EUR per user named license Trial Edition 30 days limited Enterprise Edition Limited number of received/parsed trace events © Software Competence Center Hagenberg GmbH 26
  • 27. Agenda Motivation Monitoring Approaches Firebird 2.5 Audit and Trace Services Usage of fbtracemgr FB TraceManager 2 Q&A © Software Competence Center Hagenberg GmbH 27
  • 28. Q&A Questions and Answers © Software Competence Center Hagenberg GmbH 28
  • 29. The End Thanks for your attention! thomas.steinmaurer@scch.at t.steinmaurer@upscene.com http://blog.upscene.com/thomas © Software Competence Center Hagenberg GmbH 29
  • 30. Resources Firebird 2.5 Release Notes: http://www.firebirdsql.org/devel/doc/rlsnotes/html/rlsnotes2 5.html Trace Services and Audit in Firebird 2.5, by Vlad Khorsun; Firebird Conference 2009 Munich Audit and Trace Services in Firebird 2.5, by Thomas Steinmaurer, 2010: http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp _audit_trace_steinmaurer FB TraceManager 2: http://www.upscene.com/go/?go=fbtm © Software Competence Center Hagenberg GmbH 30