nsmcp::AccessRecordParser method completionTime (public)

 <instance of nsmcp::AccessRecordParser[i]> completionTime line

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

Extract the completion timestamp from an access-log line. Accept the supported epoch or common-log timestamp without interpreting request data as executable Tcl.

Parameters:
line (required)
Raw physical log line to inspect.
Returns:
Epoch seconds, or an empty result when the timestamp cannot be parsed.

Testcases:
No testcase defined.
Source code:
if {![regexp {^\S+\s+\S+\s+(?:"(?:[^"\\]|\\.)*"|\S+)\s+(\[[^\]\r\n]+\]|[0-9]+)\s+"} $line -> stamp]} {
    return {}
}
set stamp [string trim $stamp {[]}]
if {[string is entier -strict $stamp]} {
    return $stamp
}
if {[catch {
    clock scan $stamp -format {%d/%b/%Y:%H:%M:%S %z} -locale C
} time]} {
    return {}
}
return $time
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: