Class ::nsmcp::AccessLogIngestor

::nsmcp::AccessLogIngestor[i] create ... \
           [ -maxLineBytes:integer (default "65536") ] \
           [ -maxReadBytes:integer (default "16777216") ] \
           [ -maxSeconds:integer (default "2") ] \
           [ -mutex (default "") ] \
           [ -parser (default "::nsmcp::accessRecordParser") ] \
           [ -path:required path:required ] \
           [ -retentionSeconds:double (default "86400") ]

Defined in /usr/local/ns/tcl/nsmcp/lib/access-analytics.tcl

Class Relations

  • class: ::nx::Class[i]
  • superclass: ::nx::Object[i]
  • subclass: ::nsmcp::AccessAnalytics[i]
::nx::Class create ::nsmcp::AccessLogIngestor \
     -superclass ::nx::Object

Methods (to be applied on instances)

  • ingest (scripted, public)

     <instance of nsmcp::AccessLogIngestor[i]> ingest [ from ] \
        [ allowHistory ]
    Parameters:
    from (optional)
    allowHistory (optional, defaults to "false")

    Testcases:
    No testcase defined.
    if {$from eq ""} {set from [expr {[clock seconds]-3600}]}
    if {![string is entier -strict $from] || $from < 0} {error "expected an epoch-second window start"}
    ns_mutex lock ${:mutex}
    try {return [:ingestLocked $from $allowHistory]} finally {ns_mutex unlock ${:mutex}}
  • refresh (scripted, public)

     <instance of nsmcp::AccessLogIngestor[i]> refresh

    Scheduler callback performs bounded work in a separate thread.

    Testcases:
    No testcase defined.
    if {[catch {:ingest {} true} message]} {ns_log warning "nsmcp: access ingestion failed: $message"}
  • validateWindow (scripted, public)

     <instance of nsmcp::AccessLogIngestor[i]> validateWindow options
    Parameters:
    options (required)

    Testcases:
    No testcase defined.
    foreach key [dict keys $options] {if {$key ni {from to bucketSeconds}} {error "unsupported summary option"}}
    set now [clock seconds]
    set options [dict merge [dict create from [expr {$now-3600}] to $now bucketSeconds 60] $options]
    foreach key {from to bucketSeconds} {
        if {![string is entier -strict [dict get $options $key]]} {error "expected integer epoch times and bucketSeconds"}
    }
    set from [dict get $options from]; set to [dict get $options to]; set size [dict get $options bucketSeconds]
    if {$from >= $to || $to-$from > 86400 || $from < 0 || $to > $now || $size < 60 || $size > 3600 || $size%60 != 0} {
        error "expected a window of at most 24 hours ending no later than now and bucketSeconds a multiple of 60 between 60 and 3600"
    }
    return $options