Class: LogStruct::Log::Security::IPSpoof
- Inherits:
-
T::Struct
- Object
- T::Struct
- LogStruct::Log::Security::IPSpoof
- Extended by:
- T::Sig
- Includes:
- Interfaces::AdditionalDataField, Interfaces::CommonFields, Interfaces::RequestFields, LogStruct::Log::Shared::AddRequestFields, LogStruct::Log::Shared::MergeAdditionalDataFields, LogStruct::Log::Shared::SerializeCommon
- Defined in:
- lib/log_struct/log/security/ip_spoof.rb
Constant Summary collapse
- FIELD_KEYS =
T.let( [LogField::Path, LogField::HttpMethod, LogField::SourceIp, LogField::UserAgent, LogField::Referer, LogField::Message, LogField::ClientIp, LogField::XForwardedFor].to_set(&:serialize).freeze, T::Set[Symbol] )
Constants included from LogStruct::Log::Shared::MergeAdditionalDataFields
LogStruct::Log::Shared::MergeAdditionalDataFields::NO_FIELD_KEYS, LogStruct::Log::Shared::MergeAdditionalDataFields::RESERVED_KEYS
Instance Attribute Summary collapse
-
#additional_data ⇒ Hash{String, Symbol => T.untyped}?
readonly
Additional data.
-
#client_ip ⇒ String?
readonly
Returns the value of prop
client_ip. -
#event ⇒ Event
readonly
Returns the value of prop
event. -
#http_method ⇒ String?
readonly
Returns the value of prop
http_method. -
#level ⇒ Level
readonly
Returns the value of prop
level. -
#message ⇒ String?
readonly
Event-specific fields.
-
#path ⇒ String?
readonly
Returns the value of prop
path. -
#referer ⇒ String?
readonly
Returns the value of prop
referer. -
#source ⇒ Source::Security
readonly
Shared/common fields.
-
#source_ip ⇒ String?
readonly
Returns the value of prop
source_ip. -
#timestamp ⇒ Time
readonly
Returns the value of prop
timestamp. -
#user_agent ⇒ String?
readonly
Returns the value of prop
user_agent. -
#x_forwarded_for ⇒ String?
readonly
Returns the value of prop
x_forwarded_for.
Instance Method Summary collapse
- #field_keys ⇒ Set<Symbol>
- #initialize(source: Source::Security, event: Event::IPSpoof, timestamp:, level: Level::Info, path: nil, http_method: nil, source_ip: nil, user_agent: nil, referer: nil, message: nil, client_ip: nil, x_forwarded_for: nil, additional_data: nil) ⇒ void constructor
- #to_h ⇒ Hash{LogStruct::LogField => T.untyped}
Methods included from LogStruct::Log::Shared::AddRequestFields
Methods included from LogStruct::Log::Shared::SerializeCommon
#as_json, #serialize, #serialize_common
Methods included from LogStruct::Log::Shared::MergeAdditionalDataFields
Methods included from Interfaces::CommonFieldBase
Constructor Details
#initialize(source: Source::Security, event: Event::IPSpoof, timestamp:, level: Level::Info, path: nil, http_method: nil, source_ip: nil, user_agent: nil, referer: nil, message: nil, client_ip: nil, x_forwarded_for: nil, additional_data: nil) ⇒ void
|
|
# File '' const :source, Source::Security, default: Source::Security, override: true const :event, Event, default: Event::IPSpoof, override: true const :timestamp, Time, factory: -> { Time.now }, override: true const :level, Level, default: Level::Info, override: true const :path, T.nilable(String), default: nil, override: true const :http_method, T.nilable(String), default: nil, override: true const :source_ip, T.nilable(String), default: nil, override: true const :user_agent, T.nilable(String), default: nil, override: true const :referer, T.nilable(String), default: nil, override: true const :message, T.nilable(String), default: nil const :client_ip, T.nilable(String), default: nil const :x_forwarded_for, T.nilable(String), default: nil const :additional_data, T.nilable(T::Hash[T.any(String, Symbol), T.untyped]), default: nil, override: true |
Instance Attribute Details
#additional_data ⇒ Hash{String, Symbol => T.untyped}? (readonly)
Additional data
|
|
# File '' const :additional_data, T.nilable(T::Hash[T.any(String, Symbol), T.untyped]), default: nil, override: true |
#client_ip ⇒ String? (readonly)
Returns the value of prop client_ip.
|
|
# File '' const :client_ip, T.nilable(String), default: nil |
#event ⇒ Event (readonly)
Returns the value of prop event.
|
|
# File '' const :event, Event, default: Event::IPSpoof, override: true |
#http_method ⇒ String? (readonly)
Returns the value of prop http_method.
|
|
# File '' const :http_method, T.nilable(String), default: nil, override: true |
#level ⇒ Level (readonly)
Returns the value of prop level.
|
|
# File '' const :level, Level, default: Level::Info, override: true |
#message ⇒ String? (readonly)
Event-specific fields
|
|
# File '' const :message, T.nilable(String), default: nil |
#path ⇒ String? (readonly)
Returns the value of prop path.
|
|
# File '' const :path, T.nilable(String), default: nil, override: true |
#referer ⇒ String? (readonly)
Returns the value of prop referer.
|
|
# File '' const :referer, T.nilable(String), default: nil, override: true |
#source ⇒ Source::Security (readonly)
Shared/common fields
|
|
# File '' const :source, Source::Security, default: Source::Security, override: true |
#source_ip ⇒ String? (readonly)
Returns the value of prop source_ip.
|
|
# File '' const :source_ip, T.nilable(String), default: nil, override: true |
#timestamp ⇒ Time (readonly)
Returns the value of prop timestamp.
|
|
# File '' const :timestamp, Time, factory: -> { Time.now }, override: true |
#user_agent ⇒ String? (readonly)
Returns the value of prop user_agent.
|
|
# File '' const :user_agent, T.nilable(String), default: nil, override: true |
#x_forwarded_for ⇒ String? (readonly)
Returns the value of prop x_forwarded_for.
|
|
# File '' const :x_forwarded_for, T.nilable(String), default: nil |
Instance Method Details
#field_keys ⇒ Set<Symbol>
58 59 60 |
# File 'lib/log_struct/log/security/ip_spoof.rb', line 58 def field_keys FIELD_KEYS end |
#to_h ⇒ Hash{LogStruct::LogField => T.untyped}
67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/log_struct/log/security/ip_spoof.rb', line 67 def to_h h = T.let({}, T::Hash[LogStruct::LogField, T.untyped]) h[LogField::Path] = path unless path.nil? h[LogField::HttpMethod] = http_method unless http_method.nil? h[LogField::SourceIp] = source_ip unless source_ip.nil? h[LogField::UserAgent] = user_agent unless user_agent.nil? h[LogField::Referer] = referer unless referer.nil? h[LogField::Message] = unless .nil? h[LogField::ClientIp] = client_ip unless client_ip.nil? h[LogField::XForwardedFor] = x_forwarded_for unless x_forwarded_for.nil? h end |