Module: Smplkit

Defined in:
lib/smplkit.rb,
lib/smplkit/ws.rb,
lib/smplkit/debug.rb,
lib/smplkit/client.rb,
lib/smplkit/errors.rb,
lib/smplkit/buffers.rb,
lib/smplkit/context.rb,
lib/smplkit/helpers.rb,
lib/smplkit/metrics.rb,
lib/smplkit/railtie.rb,
lib/smplkit/version.rb,
lib/smplkit/http_pool.rb,
lib/smplkit/log_level.rb,
lib/smplkit/transport.rb,
lib/smplkit/api_support.rb,
lib/smplkit/flags/types.rb,
lib/smplkit/jobs/client.rb,
lib/smplkit/jobs/models.rb,
lib/smplkit/audit/buffer.rb,
lib/smplkit/audit/client.rb,
lib/smplkit/audit/events.rb,
lib/smplkit/audit/models.rb,
lib/smplkit/flags/client.rb,
lib/smplkit/flags/models.rb,
lib/smplkit/config/client.rb,
lib/smplkit/config/models.rb,
lib/smplkit/flags/helpers.rb,
lib/smplkit/account/client.rb,
lib/smplkit/account/models.rb,
lib/smplkit/config/helpers.rb,
lib/smplkit/logging/client.rb,
lib/smplkit/logging/levels.rb,
lib/smplkit/logging/models.rb,
lib/smplkit/platform/types.rb,
lib/smplkit/logging/helpers.rb,
lib/smplkit/logging/sources.rb,
lib/smplkit/platform/client.rb,
lib/smplkit/platform/models.rb,
lib/smplkit/audit/categories.rb,
lib/smplkit/audit/forwarders.rb,
lib/smplkit/audit/event_types.rb,
lib/smplkit/config_resolution.rb,
lib/smplkit/logging/normalize.rb,
lib/smplkit/logging/resolution.rb,
lib/smplkit/audit/resource_types.rb,
lib/smplkit/logging/adapters/base.rb,
lib/smplkit/generators/install_generator.rb,
lib/smplkit/logging/adapters/stdlib_logger_adapter.rb,
lib/smplkit/logging/adapters/semantic_logger_adapter.rb

Overview

SIEM forwarder CRUD for the Smpl Audit client.

Forwarders are part of the single unified audit surface — there is no runtime/management split for audit (see Smplkit::Audit::AuditClient). This file holds the forwarder CRUD sub-client that the unified AuditClient exposes as .forwarders:

  • ForwardersClientforwarders.new/get/list/save/delete

The forwarder model classes (Forwarder, ForwarderEnvironment, …) live in lib/smplkit/audit/models.rb.

Defined Under Namespace

Modules: Account, ApiSupport, Audit, Config, ConfigResolution, Debug, Errors, Flags, Generators, Helpers, HttpPool, Jobs, Logging, Op, Platform, RequestContext, Transport Classes: ApiErrorDetail, Client, ConfigRegistrationBuffer, ConflictError, ConnectionError, Context, ContextRegistrationBuffer, ContextScope, Error, FlagDeclaration, FlagRegistrationBuffer, LogLevel, LoggerRegistrationBuffer, MetricsReporter, NotFoundError, NotInstalledError, PaymentRequiredError, Railtie, Rule, SharedWebSocket, TimeoutError, ValidationError

Constant Summary collapse

CONTEXT_REGISTRATION_LRU_SIZE =

When the deduplication LRU exceeds this size, the oldest entry is evicted. The next observation of an evicted entry will re-flush.

10_000
CONTEXT_BATCH_FLUSH_SIZE =

Pending-queue size that triggers an immediate background flush from inside register. The periodic timer on Client covers the tail case for low-traffic services.

100
FLAG_BATCH_FLUSH_SIZE =
50
LOGGER_BATCH_FLUSH_SIZE =
50
CONFIG_BATCH_FLUSH_SIZE =
50
VERSION =
"0.0.0"
JobsClient =
Jobs::JobsClient
FlagsClient =
Flags::FlagsClient
FlagValue =

Top-level re-exports for convenience.

Flags::FlagValue
FlagRule =
Flags::FlagRule
FlagEnvironment =
Flags::FlagEnvironment
ConfigClient =
Config::ConfigClient
ConfigItem =

Top-level re-exports.

Config::ConfigItem
ConfigEnvironment =
Config::ConfigEnvironment
ItemType =
Config::ItemType
AccountClient =
Account::AccountClient
LoggingClient =
Logging::LoggingClient
Color =
Platform::Color
EnvironmentClassification =
Platform::EnvironmentClassification
LoggerSource =

Top-level re-export.

Logging::LoggerSource
PlatformClient =
Platform::PlatformClient
LoggingAdapter =

Top-level re-export.

Logging::Adapters::Base
StdlibLoggerAdapter =
Logging::Adapters::StdlibLoggerAdapter

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.clientObject

Returns the value of attribute client.



46
47
48
# File 'lib/smplkit/railtie.rb', line 46

def client
  @client
end

.context_providerObject

Returns the value of attribute context_provider.



46
47
48
# File 'lib/smplkit/railtie.rb', line 46

def context_provider
  @context_provider
end

Class Method Details

.configure_for_rails(options) ⇒ Object

Construct the global Smplkit.client from a Rails-friendly options struct. Falls back to SMPLKIT_* env vars + ~/.smplkit resolution for any field the customer left blank.



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/smplkit/railtie.rb', line 29

def configure_for_rails(options)
  client = Client.new(
    api_key: options.api_key,
    environment: options.environment || (defined?(::Rails) ? ::Rails.env : nil),
    service: options.service,
    profile: options.profile,
    base_domain: options.base_domain,
    scheme: options.scheme,
    debug: options.debug,
    telemetry: options.telemetry
  )
  @client = client
  @context_provider = options.context_provider
  client
end

.debug(subsystem, message) ⇒ Object



43
44
45
# File 'lib/smplkit/debug.rb', line 43

def debug(subsystem, message)
  Debug.emit(subsystem, message)
end

.enable_debugObject



47
48
49
# File 'lib/smplkit/debug.rb', line 47

def enable_debug
  Debug.enable!
end

.request_contextObject



65
66
67
# File 'lib/smplkit/context.rb', line 65

def request_context
  RequestContext.get
end

.set_request_context(contexts) ⇒ Object



60
61
62
63
# File 'lib/smplkit/context.rb', line 60

def set_request_context(contexts)
  previous = RequestContext.set(contexts)
  ContextScope.new(previous)
end