nsmcp::accessScanAdd

 nsmcp::accessScanAdd

Defined in

Partial Call Graph (max 5 caller/called nodes):
accessFileScan accessFileScan nsmcp::accessScanAdd nsmcp::accessScanAdd accessFileScan->nsmcp::accessScanAdd instproc instproc instproc->nsmcp::accessScanAdd nsmcp::LogCorrelation nsmcp::LogCorrelation nsmcp::LogCorrelation->nsmcp::accessScanAdd nsmcp::accessFailureContext nsmcp::accessFailureContext nsmcp::accessScanAdd->nsmcp::accessFailureContext nsmcp::accessScanCount nsmcp::accessScanCount nsmcp::accessScanAdd->nsmcp::accessScanCount nsmcp::accessScanSample nsmcp::accessScanSample nsmcp::accessScanAdd->nsmcp::accessScanSample

Testcases:
No testcase defined.
Source code:
    upvar 1 $statsVar stats
    set time [dict get $row startTime]
    if {$time<[dict get $options from] || $time>=[dict get $options to]} {
        return
    }
    set path [dict get $row path]
    # Match the logged, queryless path literally, without decoding or regexp.
    if {[dict get $options pathLiteral] ne "" && [string first [dict get $options pathLiteral] $path]<0} {
        return
    }
    if {![::nsmcp::accessFailureContext stats $row $options]} {
        return
    }
    if {![dict exists $stats matchedFirstAt] || $time<[dict get $stats matchedFirstAt]} {
        dict set stats matchedFirstAt $time
    }
    if {![dict exists $stats matchedLastAt] || $time>[dict get $stats matchedLastAt]} {
        dict set stats matchedLastAt $time
    }
    dict incr stats requestCount
    if {[dict get $row status]<400} {
        dict incr stats statusBelow400Records
    }
    dict incr stats responseBytes [dict get $row responseBytes]
    set auth [dict get $stats authenticationStates]
    dict incr auth [dict get $row authenticationState]
    dict set stats authenticationStates $auth
    if {[dict get $row timingSource] eq "completion"} {
        dict incr stats fallbackCount
    }
    if {[dict get $row phaseTimingAvailable]} {
        dict incr stats timingCount
        foreach key {accept queue filter run} {
            dict set stats ${key}Total [expr {[dict get $stats ${key}Total]+[dict get $row ${key}Time]}]
        }
        dict set stats runMax [expr {max([dict get $stats runMax],[dict get $row runTime])}]
    }
    foreach {field key capacity} [list paths path [dict get $limits keys] methods method 32 statuses status 500 pools pool 64] {
        set value [dict get $row $key]
        # Hash overlong keys into an explicit overflow count, never merge prefixes.
        if {[string length [encoding convertto utf-8 $value]]>1024} {
            set omitted [dict get $stats omittedRecords]
            dict incr omitted $field
            dict set stats omittedRecords $omitted
        } else {
            accessScanCount stats $field [$redactor message $value] $capacity
        }
    }
    accessScanCount stats hours [expr {wide(floor($time/3600))*3600}] 170
    if {![dict exists $row userAgent] || [dict get $row userAgent] in {{} -}} {
        dict incr stats unknownUserAgentRecords
    } elseif {[string length [encoding convertto utf-8 [dict get $row userAgent]]]>1024} {
        dict incr stats truncatedUserAgentRecords
    } elseif {![dict exists $options aggregateWriter]} {
        accessScanCount stats agents [$redactor message [dict get $row userAgent]] [dict get $limits agents]
    }
    set peer [dict get $row peerAddress]
    if {$peer in {{} - {[REDACTED]}}} {
        dict incr stats unknownPeerRecords
    } elseif {![dict exists $options aggregateWriter]} {
        # Raw addresses never enter continuation state or ordinary results.
        set hash [ns_crypto::md string -digest sha256 -- $peer]
        accessScanCount stats peers $hash [dict get $limits peers]
    }
    if {[dict exists $options aggregateWriter]} {
        [dict get $options aggregateWriter] add $row $redactor
    }
    # Stable hash priority spreads evidence across the whole scan, not first-N.
    set score [ns_crypto::md string -digest sha256 -- [list [dict get $file identity] $offset]]
    set sample [accessScanSample $row $file $offset $redactor]
    foreach field [expr {[dict get $row status]<400 ? {samples successSamples} : {samples}}] {
        set samples [dict get $stats $field]
        lappend samples [list $score $sample]
        dict set stats $field [lrange [lsort -ascii -index 0 $samples] 0 4]
    }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: