Class ::nsmcp::AccessRecordParser

::nsmcp::AccessRecordParser[i] create ... \
           [ -timingColumn:integer (default "-1") ]

-1 detects common/combined layouts; -2 disables timing detection. Explicit 0 (common) or 2 (combined) can pin the configured column.
Defined in /usr/local/ns/tcl/nsmcp/access-record.tcl

Class Relations

  • class: ::nx::Class[i]
  • superclass: ::nsmcp::Object[i]

Methods (to be applied on instances)

  • completionTime (scripted, public)

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

    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.
  • failureReason (scripted, public)

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

    Classify why an access-log line could not be parsed. This diagnostic path runs only for rejected rows and distinguishes layout, timestamp and request failures.

    Parameters:
    line (required)
    Raw physical log line to inspect.
    Returns:
    The failure category: layout, timestamp or request.

    Testcases:
    No testcase defined.
  • fields (scripted, public)

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

    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.
  • indexTime (scripted, public)

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

    Extract a bounded timestamp suitable for access-log indexing. Reject NUL-bearing or unsupported lines before deriving the record's index time.

    Parameters:
    line (required)
    Raw physical log line to inspect.
    Returns:
    The index timestamp, or an empty result for an unusable line.

    Testcases:
    No testcase defined.
  • parse (scripted, public)

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

    Parse one physical access-log line into a request record. Validate the supported layout and delegate decoded fields to the common field normalizer.

    Parameters:
    line (required)
    Raw physical log line to inspect.
    Returns:
    A request dictionary, or an empty result for a rejected line.

    Testcases:
    No testcase defined.
  • requestFields (scripted, public)

     <instance of nsmcp::AccessRecordParser[i]> requestFields peer \
        identifier user timestamp request status bytes combined agent \
        timing

    Build a request record from validated fields and timing. Derive authentication and request metadata while retaining explicit unknown-value representations.

    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.
    timestamp (required)
    Parsed timestamp or timing base supplied by the parser.
    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.
    combined (required)
    Whether the decoded access line uses the combined format.
    agent (required)
    Decoded User-Agent value.
    timing (required)
    Normalized request-timing dictionary.
    Returns:
    The normalized request dictionary.

    Testcases:
    No testcase defined.
  • timingMicroseconds (scripted, public)

     <instance of nsmcp::AccessRecordParser[i]> timingMicroseconds \
        timestamp start accept queue filter run

    Convert C-parsed request timing values to the parser's timing fields. Use supplied microsecond values directly, normalizing start time and phase durations to seconds.

    Parameters:
    timestamp (required)
    Parsed timestamp or timing base supplied by the parser.
    start (required)
    Request start timestamp in microseconds.
    accept (required)
    Accept-phase duration in microseconds.
    queue (required)
    Queue-phase duration in microseconds.
    filter (required)
    Filter-phase duration in microseconds, or the line-prefilter flag for nextLine.
    run (required)
    Run-phase duration in microseconds.
    Returns:
    A timing dictionary containing the available parsed phases.

    Testcases:
    No testcase defined.