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
Instance Attribute Summary collapse
-
#additional_data ⇒ Hash{String, Symbol => T.untyped}?
readonly
Returns the value of prop
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. -
#request_id ⇒ String?
readonly
Returns the value of prop
request_id. -
#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
- #initialize(source: Source::Security, event: Event::IPSpoof, timestamp:, level: Level::Info, path: nil, http_method: nil, source_ip: nil, user_agent: nil, referer: nil, request_id: 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 Interfaces::CommonFields
Methods included from LogStruct::Log::Shared::MergeAdditionalDataFields
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, request_id: nil, message: nil, client_ip: nil, x_forwarded_for: nil, additional_data: nil) ⇒ void
|
|
# File '' const :source, Source::Security, default: Source::Security const :event, Event, default: Event::IPSpoof const :timestamp, Time, factory: -> { Time.now } const :level, Level, default: Level::Info const :path, T.nilable(String), default: nil const :http_method, T.nilable(String), default: nil const :source_ip, T.nilable(String), default: nil const :user_agent, T.nilable(String), default: nil const :referer, T.nilable(String), default: nil const :request_id, T.nilable(String), default: nil 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 |
Instance Attribute Details
#additional_data ⇒ Hash{String, Symbol => T.untyped}? (readonly)
Returns the value of prop additional_data.
|
|
# File '' const :additional_data, T.nilable(T::Hash[T.any(String, Symbol), T.untyped]), default: nil |
#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 |
#http_method ⇒ String? (readonly)
Returns the value of prop http_method.
|
|
# File '' const :http_method, T.nilable(String), default: nil |
#level ⇒ Level (readonly)
Returns the value of prop level.
|
|
# File '' const :level, Level, default: Level::Info |
#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 |
#referer ⇒ String? (readonly)
Returns the value of prop referer.
|
|
# File '' const :referer, T.nilable(String), default: nil |
#request_id ⇒ String? (readonly)
Returns the value of prop request_id.
|
|
# File '' const :request_id, T.nilable(String), default: nil |
#source ⇒ Source::Security (readonly)
Shared/common fields
|
|
# File '' const :source, Source::Security, default: Source::Security |
#source_ip ⇒ String? (readonly)
Returns the value of prop source_ip.
|
|
# File '' const :source_ip, T.nilable(String), default: nil |
#timestamp ⇒ Time (readonly)
Returns the value of prop timestamp.
|
|
# File '' const :timestamp, Time, factory: -> { Time.now } |
#user_agent ⇒ String? (readonly)
Returns the value of prop user_agent.
|
|
# File '' const :user_agent, T.nilable(String), default: nil |
#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
#to_h ⇒ Hash{LogStruct::LogField => T.untyped}
58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/log_struct/log/security/ip_spoof.rb', line 58 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::RequestId] = request_id unless request_id.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 |