Class ::nsmcp::SystemLogUrls (public)

 ::nx::Class ::nsmcp::SystemLogUrls[i]

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

Testcases:
No testcase defined.
Source code:
    :public object method empty {} {
        #
        # Initialize the selected-warning URL accumulator.
        #
        return {recordCount 0 truncatedRecordCount 0 recordsWithUrl 0 unknownUrlRecords 0 oversizedUrlRecords 0 conflictingUrlRecords 0 capacityOmittedRecords 0 methods {} urls {}}
    }

    :public object method add {statsVar text timestamp identifier redactor {truncated false} {capacity 4096}} {
        #
        # Update the caller’s URL accumulator from one warning diagnostic.
        #
        upvar 1 $statsVar stats
        dict incr stats recordCount
        if {$truncated} {
            dict incr stats truncatedRecordCount
        }
        set request [::nsmcp::summaryRequestUrl $text]
        set method [dict get $request method]
        set counts [dict get $stats methods]
        dict incr counts $method
        dict set stats methods $counts
        set path [dict get $request path]
        if {$path eq {}} {
            dict incr stats unknownUrlRecords
            if {[dict get $request reason] eq "oversized"} {
                dict incr stats oversizedUrlRecords
            }
            if {[dict get $request reason] eq "conflicting"} {
                dict incr stats conflictingUrlRecords
            }
            return
        }
        dict incr stats recordsWithUrl
        if {![dict exists $stats urls $path]} {
            if {[dict size [dict get $stats urls]] >= $capacity} {
                dict incr stats capacityOmittedRecords
                return
            }
            set id {}
            if {[string length $identifier]<=256 && [::nsmcp::logRecordParser validConnectionIdentifier $identifier]} {
                set id $identifier
            }
            dict set stats urls $path [dict create count 0 firstAt $timestamp lastAt $timestamp methods {}  authenticationStates {anonymous 0 authenticated 0 unknown 0} representativeRequestIdentifier $id]
        }
        set entry [dict get $stats urls $path]
        dict incr entry count
        dict set entry firstAt [expr {min([dict get $entry firstAt],$timestamp)}]
        dict set entry lastAt [expr {max([dict get $entry lastAt],$timestamp)}]
        set counts [dict get $entry methods]
        dict incr counts $method
        dict set entry methods $counts
        set origin [::nsmcp::SystemLogSummary requestMetadata $text $redactor]
        set counts [dict get $entry authenticationStates]
        dict incr counts [dict get $origin authenticationState]
        dict set entry authenticationStates $counts
        dict set stats urls $path $entry
    }

    :public object method fields {stats maxGroups scanComplete uncertain redactor} {
        #
        # Encode URL rankings and coverage as typed JSON members.
        #
        set ordered {}
        dict for {path entry} [dict get $stats urls] {
            lappend ordered [list [dict get $entry count] $path $entry]
        }
        # Stable tie order; counts are exact for retained paths across the full scan.
        set ordered [lsort -integer -decreasing -index 0 [lsort -index 1 $ordered]]
        set rows {}
        set i 0
        set returned 0
        set omittedRecords 0
        set omittedGroups 0
        foreach row $ordered {
            lassign $row count path entry
            if {$i >= $maxGroups} {
                incr omittedRecords $count
                incr omittedGroups
                continue
            }
            set methods {}
            set auth {}
            dict for {method n} [dict get $entry methods] {
                lappend methods $method number $n
            }
            dict for {state n} [dict get $entry authenticationStates] {
                lappend auth $state number $n
            }
            lappend rows $i object [list path string [$redactor message $path] count number $count  firstAt number [dict get $entry firstAt] lastAt number [dict get $entry lastAt]  methodCounts object $methods authenticationStates object $auth  representativeRequestIdentifier string [dict get $entry representativeRequestIdentifier]]
            incr returned $count
            incr i
        }
        set fields {}
        foreach name {recordCount truncatedRecordCount recordsWithUrl unknownUrlRecords oversizedUrlRecords conflictingUrlRecords capacityOmittedRecords} {
            lappend fields $name number [dict get $stats $name]
        }
        set countsComplete [expr {[dict get $stats unknownUrlRecords]==0 && [dict get $stats capacityOmittedRecords]==0 && [dict get $stats truncatedRecordCount]==0 && $uncertain==0}]
        set methods {}
        dict for {method n} [dict get $stats methods] {
            lappend methods $method number $n
        }
        return [concat $fields [list evidenceSource string system-log-request-diagnostic  countUnit string physical-log-records pathScope string queryless-logged-path  queryValuesExcluded boolean true pathMaxBytes number 1024 groupCapacity number 4096  trackedDistinctUrls number [dict size [dict get $stats urls]]  distinctUrlsIsLowerBound boolean [expr {!$countsComplete || !$scanComplete}]  returnedUrlCount number $i returnedUrlRecords number $returned  rankedOmittedGroups number $omittedGroups rankedOmittedRecords number $omittedRecords  countsComplete boolean $countsComplete scanComplete boolean $scanComplete  aggregationComplete boolean [expr {$countsComplete && $scanComplete}]  rankingComplete boolean [expr {$countsComplete && $scanComplete && $omittedGroups==0}]  responseStatusesAvailable boolean false unknownResponseStatusRecords number [dict get $stats recordCount]  methodCounts object $methods urls array $rows  limitations string {Counts cover literal-selected physical log records within the requested window across the examined snapshot, before detailed-group and ranking limits. They are not unique requests or expanded suppressed occurrences. Only explicit request_info diagnostic lines establish a URL; arbitrary message/header URLs are ignored. Query strings, fragments, origins and peer addresses are not returned here. Paths retain case and percent encoding. Missing, conflicting and oversized paths remain unknown; oversized/conflicting counts are subsets of unknownUrlRecords. Capacity omissions are not ranking omissions, and can hide frequent paths. Response statuses are not inferred from warning wording; use selective correlation if needed. File retention and truncated literal-selection evidence remain separate coverage limits.}]]
    }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: