nsmcp::AccessRecordParser method fields (public)

 <instance of nsmcp::AccessRecordParser[i]> fields peer identifier \
    user stamp request status bytes tail [ scannedFields ] \
    [ parsedTiming ]

Defined in /usr/local/ns/tcl/nsmcp/access-record.tcl

Normalize decoded access-log fields into a request record. Combine scanned metadata and optional C-parsed timing with the same validation used by Tcl scanning.

Parameters:
peer (required)
Logged peer address, including the supported unknown-value sentinel.
identifier (required)
Complete log-thread identifier, or the raw identifier field when parsing access records.
user (required)
Logged user identifier used to derive authentication state.
stamp (required)
Original access-log timestamp field.
request (required)
Decoded HTTP request-line field.
status (required)
Decoded HTTP response status.
bytes (required)
Logged response-byte value, retaining the supported unknown-value sentinel.
tail (required)
Remaining access-log fields after status and response size.
scannedFields (optional)
Optional metadata already decoded by the C scanner.
parsedTiming (optional)
Optional timing dictionary already decoded by the C scanner.
Returns:
A normalized request dictionary, or an empty result for invalid fields.

Testcases:
No testcase defined.
Source code:
if {![regexp {^[1-5][0-9]{2}$} $status]} {
    return {}
}
set timestamp [string trim $stamp {[]}]
set fields $scannedFields
if {$fields eq {}} {
    set fields [regexp -all -inline {"(?:[^"\\]|\\.)*"} $tail]
}
set combined [expr {[llength $fields]>=2}]
set agent {}
set escapes [list {\\} \\ {\"} \" {\n} \n {\r} \r {\t} \t]
if {$combined} {
    set agent [string map $escapes [string range [lindex $fields 1] 1 end-1]]
}
set request [string map $escapes $request]
if {[string index $user 0] eq {"}} {
    set user [string map $escapes [string range $user 1 end-1]]
}
if {$parsedTiming eq {}} {
    set parsedTiming [:timingFields $timestamp $fields]
}
if {$parsedTiming eq {}} {
    return {}
}
set responseBytes 0
if {$bytes ne "-"} {
    set responseBytes [scan $bytes %lld]
}
return [:requestFields $peer $identifier $user $timestamp $request  [scan $status %d] $responseBytes $combined $agent $parsedTiming]
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: