Class ::nsmcp::LogCorrelation (public)
::nx::Class ::nsmcp::LogCorrelation
Defined in /usr/local/ns/tcl/nsmcp/log-traffic-unified.tcl
- Testcases:
- No testcase defined.
Source code: :property systemSearch:required :property {accessSearches {}} :property {parser ::nsmcp::logRecordParser} :public method entries {level {literal {}} {limit 0}} { # # Search system-log entries by severity and optional literal text. # # Delegate to the configured system search, retaining its bounded-result and # cache semantics. # # @param level System-log severity name to match. # @param literal Literal search text; an empty value disables this # additional text filter. # @param limit Maximum number of records or entries to return. Defaults to # '0'. # # @return The search result descriptor. # if {![regexp {^[A-Za-z][A-Za-z0-9_()-]*$} $level]} { error "expected a log severity name" } return [${:systemSearch} search [expr {$literal eq "" ? "${level}:" : $literal}] $level {} $limit] } :public method errors {{severity Error} {literal {}} {limit 0}} { # # Search retained system-log errors at the requested severity. # # Use entries with the supplied literal and result bound. # # @param severity System-log severity name to match. Defaults to 'Error'. # @param literal Literal search text; an empty value disables this # additional text filter. # @param limit Maximum number of records or entries to return. Defaults to # '0'. # # @return The search result descriptor. # return [:entries $severity $literal $limit] } :public method results {handle {cursor 0} {limit 20}} { # # Retrieve a page from a correlation service's cached searches. # # Try the configured system and access searches; propagate an unknown-handle # error when none owns the result. # # @param handle Retained job or conversation handle; ownership and expiry # checks still apply. # @param cursor Zero-based cursor into retained results. Defaults to '0'. # @param limit Maximum number of records or entries to return. Defaults to # '20'. # # @return The matching cached result page. # foreach source [list ${:systemSearch} {*}${:accessSearches}] { try { return [$source results $handle $cursor $limit] } trap {NSMCP RESULT UNKNOWN} {} { # Try the next configured source, never a caller-supplied path. } } return -code error -errorcode {NSMCP RESULT UNKNOWN} "unknown or expired result handle" } :public method requestContexts {identifiers {limit 100}} { # # Correlate a bounded batch of complete request identifiers. # # Scan each configured file in one forward pass rather than running an # independent scan for every identifier. Retain each record's own # identifier. # # @param identifiers One to twenty exact dash-delimited NaviServer # log-thread identifiers. # @param limit Maximum number of records or entries to return. Defaults to # '100'. # # @return Combined system/access snapshots with coverage and per-record # identifiers. # if {![string is integer -strict $limit] || $limit < 1 || $limit > 100} { error "batch result limit must be 1..100" } if {[llength $identifiers] < 1 || [llength $identifiers] > 20} { error "expected 1..20 request identifiers" } set identifiers [lsort -unique $identifiers] set connectionIds {} foreach id $identifiers { if {![${:parser} validRequestIdentifier $id]} { error "expected complete request identifiers" } if {[${:parser} validConnectionIdentifier $id]} { lappend connectionIds $id } } set access {} if {$connectionIds ne ""} { foreach source ${:accessSearches} { dict set access $source [$source search $connectionIds {} accessMany $limit] } } return [dict create requestIdentifiers $identifiers system [${:systemSearch} search $identifiers {} systemMany $limit] access $access] } :public method requestContext {identifier} { # # Correlate one complete request identifier across configured logs. # # Validate the identifier before searching system and access records. # # @param identifier Complete log-thread identifier, or the raw identifier # field when parsing access records. # # @return The request's bounded correlation evidence. # if {![${:parser} validRequestIdentifier $identifier]} { error "expected a complete dash-delimited NaviServer log-thread identifier" } set access {} if {[${:parser} validConnectionIdentifier $identifier]} { foreach source ${:accessSearches} { dict set access $source [$source search $identifier {} access] } } return [dict create requestIdentifier $identifier system [${:systemSearch} search $identifier {} system] access $access] }XQL Not present: Generic, PostgreSQL, Oracle
![[i]](/resources/acs-subsite/ZoomIn16.gif)