Class ::nsmcp::LogCorrelation (public)

 ::nx::Class ::nsmcp::LogCorrelation[i]

Defined in /usr/local/ns/tcl/nsmcp/log-traffic-summary.tcl

Testcases:
No testcase defined.
Source code:
    :property systemSearch:required
    :property {accessSearches {}}
    :property {parser ::nsmcp::logRecordParser}
    :public method entries {level {literal {}} {limit 0}} {
        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}} {return [:entries $severity $literal $limit]}
    :public method results {handle {cursor 0} {limit 20}} {
        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 in one forward pass per configured file.
        # @param identifiers 1..20 exact dash-delimited log-thread identifiers
        # @param limit maximum retained records per source
        # @return combined system/access snapshots; records retain their own IDs
        #
        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} {
        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
[ hide source ] | [ make this the default ]
Show another procedure: