nsmcp::LogCorrelation method configureAccessAnalytics (public)
<instance of nsmcp::LogCorrelation> configureAccessAnalytics \ section path
Defined in /usr/local/ns/tcl/nsmcp/log-traffic-unified.tcl
Configure access analytics for the selected log source. Read the module section and attach the available store-backed analytics implementation.
- Parameters:
- section (required)
- NaviServer module configuration section.
- path (required)
- Configured source or database path.
- Returns:
- The configured analytics setup result.
- Testcases:
- No testcase defined.
Source code: set settings [:accessRecordStoreSettings] if {$settings eq {}} { set pool [ns_config $section accessRecordPool [ns_config $section databasePool {}]] if {$pool eq {}} { error "continuous access store requires a SQLite pool" } set directory [file join [file dirname [::nsmcp::database path]] access-records] set settings [dict create directory $directory pool $pool maxBytes [accessScanBudget [ns_config $section accessRecordMaxBytes 64GiB]] retention [ns_baseunit -time [ns_config $section accessRecordRetention 7d]]] } set legacyPeer [ns_baseunit -time [ns_config $section accessRetention 24h]] dict set settings ingestion [ns_config $section accessRecordIngestion tcl] if {[dict get $settings ingestion] ni {tcl c batch}} { error "accessRecordIngestion must be tcl or c (batch is a legacy alias for c)" } dict set settings lockWaitMs [:accessRecordLockWait $section] dict set settings peerRetention [ns_baseunit -time [ns_config $section accessPeerRetention [expr {min(86400,$legacyPeer)}]]] if {[dict get $settings peerRetention]<1 || [dict get $settings peerRetention]>[dict get $settings retention]} { error "accessPeerRetention must be positive and no longer than accessRecordRetention" } if {![nsf::object::exists ::nsmcp::unifiedRedactor]} { ::nsmcp::LogRedactor create ::nsmcp::unifiedRedactor } set settings [accessUnifiedPolicy $settings ::nsmcp::unifiedRedactor] set maintenance [ns_baseunit -time [ns_config $section accessRetentionInterval 30s]] if {$maintenance<1} { error "accessRetentionInterval must be at least 1s" } dict set settings sourcePath [file normalize $path] nsv_set nsmcp:access-store:[ns_info server] settings $settings ::nsmcp::UnifiedAccessAnalytics create ::nsmcp::accessAnalytics -path $path -settings $settings -database ::nsmcp::database -ingestBytes [accessScanBudget [ns_config $section accessIngestMaxBytes 16MiB]] -ingestMilliseconds [expr {int(1000*[ns_baseunit -time [ns_config $section accessIngestMaxTime 2s]])}] -retentionInterval $maintenance -retentionBatchRows [ns_config -int $section accessRetentionBatchRows 1000] -retentionMilliseconds [expr {int(1000*[ns_baseunit -time [ns_config $section accessRetentionMaxTime 1s]])}] set interval [ns_baseunit -time [ns_config $section accessIngestInterval 5s]] if {$interval<1} { error "accessIngestInterval must be at least 1s" } ns_schedule_proc -thread $interval ::nsmcp::accessAnalytics refresh ns_schedule_proc -once -thread $maintenance ::nsmcp::accessAnalytics retentionTickXQL Not present: Generic, PostgreSQL, Oracle
![[i]](/resources/acs-subsite/ZoomIn16.gif)