Class: Contrast::Agent::Reporting::Settings::Syslog
- Defined in:
- lib/contrast/agent/reporting/settings/syslog.rb
Overview
Controls for the syslogging feature in the agent
Constant Summary collapse
- CONNECTION_TYPE =
%w[UNENCRYPTED ENCRYPTED].cs__freeze
- SEVERITIES =
Used for: severity_blocked, severity_blocked_perimeter, severity_exploited, severity_probed, severity_probed_perimeter
%w[ALERT CRITICAL ERROR WARNING NOTICE INFO DEBUG].cs__freeze
- SYSLOG_METHODS_NG =
Order and elements matter, the same setter must be called against same response field.
%i[ enable= ip= port= facility= protocol= connection_type= severity_exploited= severity_blocked= severity_probed= severity_probed_suspicious= severity_blocked_perimeter= severity_probed_perimeter= ].cs__freeze
- SYSLOG_RESPONSE_KEYS_NG =
%i[ syslogEnabled syslogIpAddress syslogPortNumber syslogFacilityCode syslogProtocol syslogConnectionType syslogSeverityExploited syslogSeverityBlocked syslogSeverityProbed syslogSeveritySuspicious syslogSeverityBlockedPerimeter syslogSeverityProbedPerimeter ].cs__freeze
- SYSLOG_METHODS =
%i[ enable= ip= port= facility= connection_type= severity_blocked= severity_blocked_perimeter= severity_exploited= severity_probed= severity_probed_perimeter= ].cs__freeze
- SYSLOG_RESPONSE_KEYS =
%i[ enable ip facility connection_type severity_blocked severity_blocked_perimeter severity_exploited severity_probed severity_probed_perimeter ].cs__freeze
Instance Attribute Summary collapse
-
#enable ⇒ Object
Returns the value of attribute enable.
-
#facility ⇒ Object
Returns the value of attribute facility.
-
#ip ⇒ Object
Returns the value of attribute ip.
-
#port ⇒ Object
Returns the value of attribute port.
-
#protocol ⇒ Object
Returns the value of attribute protocol.
Instance Method Summary collapse
- #assign_array(settings_array, ng_: true) ⇒ Object
- #connection_type ⇒ Object
-
#connection_type=(type) ⇒ Object
Set the connection type.
-
#initialize ⇒ Syslog
constructor
A new instance of Syslog.
-
#not_blank! ⇒ Boolean
Set the state of settings.
-
#settings_blank? ⇒ Boolean
check to see if object is being used.
- #severity_blocked ⇒ Object
-
#severity_blocked=(severity) ⇒ Object
Set the severity type.
- #severity_blocked_perimeter ⇒ Object
-
#severity_blocked_perimeter=(severity) ⇒ Object
Set the severity type.
- #severity_exploited ⇒ Object
-
#severity_exploited=(severity) ⇒ Object
Set the severity type.
- #severity_probed ⇒ Object
-
#severity_probed=(severity) ⇒ Object
Set the severity type.
- #severity_probed_perimeter ⇒ Object
-
#severity_probed_perimeter=(severity) ⇒ Object
Set the severity type.
- #severity_probed_suspicious ⇒ Object
-
#severity_probed_suspicious=(severity) ⇒ Object
Set the severity type.
- #to_controlled_hash ⇒ Object
Constructor Details
#initialize ⇒ Syslog
Returns a new instance of Syslog.
47 48 49 50 51 52 53 |
# File 'lib/contrast/agent/reporting/settings/syslog.rb', line 47 def initialize @enable = false @ip = Contrast::Utils::ObjectShare::EMPTY_STRING @port = 0 @facility = 0 @blank = true end |
Instance Attribute Details
#enable ⇒ Object
Returns the value of attribute enable.
37 38 39 |
# File 'lib/contrast/agent/reporting/settings/syslog.rb', line 37 def enable @enable end |
#facility ⇒ Object
Returns the value of attribute facility.
43 44 45 |
# File 'lib/contrast/agent/reporting/settings/syslog.rb', line 43 def facility @facility end |
#ip ⇒ Object
Returns the value of attribute ip.
39 40 41 |
# File 'lib/contrast/agent/reporting/settings/syslog.rb', line 39 def ip @ip end |
#port ⇒ Object
Returns the value of attribute port.
41 42 43 |
# File 'lib/contrast/agent/reporting/settings/syslog.rb', line 41 def port @port end |
#protocol ⇒ Object
Returns the value of attribute protocol.
45 46 47 |
# File 'lib/contrast/agent/reporting/settings/syslog.rb', line 45 def protocol @protocol end |
Instance Method Details
#assign_array(settings_array, ng_: true) ⇒ Object
162 163 164 165 166 167 168 169 170 |
# File 'lib/contrast/agent/reporting/settings/syslog.rb', line 162 def assign_array settings_array, ng_: true methods = ng_ ? SYSLOG_METHODS_NG : SYSLOG_METHODS response_keys = ng_ ? SYSLOG_RESPONSE_KEYS_NG : SYSLOG_RESPONSE_KEYS methods.each_with_index do |method, index| send(method, settings_array[response_keys[index]]) end not_blank! end |
#connection_type ⇒ Object
70 71 72 |
# File 'lib/contrast/agent/reporting/settings/syslog.rb', line 70 def connection_type @_connection_type ||= Contrast::Utils::ObjectShare::EMPTY_STRING end |
#connection_type=(type) ⇒ Object
Set the connection type
78 79 80 |
# File 'lib/contrast/agent/reporting/settings/syslog.rb', line 78 def connection_type= type @_connection_type = type if valid_entry?(type, CONNECTION_TYPE) end |
#not_blank! ⇒ Boolean
Set the state of settings
65 66 67 |
# File 'lib/contrast/agent/reporting/settings/syslog.rb', line 65 def not_blank! @blank = false end |
#settings_blank? ⇒ Boolean
check to see if object is being used
58 59 60 |
# File 'lib/contrast/agent/reporting/settings/syslog.rb', line 58 def settings_blank? @blank end |
#severity_blocked ⇒ Object
83 84 85 |
# File 'lib/contrast/agent/reporting/settings/syslog.rb', line 83 def severity_blocked @_severity_blocked ||= Contrast::Utils::ObjectShare::EMPTY_STRING end |
#severity_blocked=(severity) ⇒ Object
Set the severity type
91 92 93 |
# File 'lib/contrast/agent/reporting/settings/syslog.rb', line 91 def severity_blocked= severity @_severity_blocked = severity if valid_entry?(severity, SEVERITIES) end |
#severity_blocked_perimeter ⇒ Object
96 97 98 |
# File 'lib/contrast/agent/reporting/settings/syslog.rb', line 96 def severity_blocked_perimeter @_severity_blocked_perimeter ||= Contrast::Utils::ObjectShare::EMPTY_STRING end |
#severity_blocked_perimeter=(severity) ⇒ Object
Set the severity type
104 105 106 |
# File 'lib/contrast/agent/reporting/settings/syslog.rb', line 104 def severity_blocked_perimeter= severity @_severity_blocked_perimeter = severity if valid_entry?(severity, SEVERITIES) end |
#severity_exploited ⇒ Object
109 110 111 |
# File 'lib/contrast/agent/reporting/settings/syslog.rb', line 109 def severity_exploited @_severity_exploited ||= Contrast::Utils::ObjectShare::EMPTY_STRING end |
#severity_exploited=(severity) ⇒ Object
Set the severity type
117 118 119 |
# File 'lib/contrast/agent/reporting/settings/syslog.rb', line 117 def severity_exploited= severity @_severity_exploited = severity if valid_entry?(severity, SEVERITIES) end |
#severity_probed ⇒ Object
122 123 124 |
# File 'lib/contrast/agent/reporting/settings/syslog.rb', line 122 def severity_probed @_severity_probed ||= Contrast::Utils::ObjectShare::EMPTY_STRING end |
#severity_probed=(severity) ⇒ Object
Set the severity type
130 131 132 |
# File 'lib/contrast/agent/reporting/settings/syslog.rb', line 130 def severity_probed= severity @_severity_probed = severity if valid_entry?(severity, SEVERITIES) end |
#severity_probed_perimeter ⇒ Object
135 136 137 |
# File 'lib/contrast/agent/reporting/settings/syslog.rb', line 135 def severity_probed_perimeter @_severity_probed_perimeter ||= Contrast::Utils::ObjectShare::EMPTY_STRING end |
#severity_probed_perimeter=(severity) ⇒ Object
Set the severity type
143 144 145 |
# File 'lib/contrast/agent/reporting/settings/syslog.rb', line 143 def severity_probed_perimeter= severity @_severity_probed_perimeter = severity if valid_entry?(severity, SEVERITIES) end |
#severity_probed_suspicious ⇒ Object
148 149 150 |
# File 'lib/contrast/agent/reporting/settings/syslog.rb', line 148 def severity_probed_suspicious @_severity_probed_suspicious ||= Contrast::Utils::ObjectShare::EMPTY_STRING end |
#severity_probed_suspicious=(severity) ⇒ Object
Set the severity type
156 157 158 |
# File 'lib/contrast/agent/reporting/settings/syslog.rb', line 156 def severity_probed_suspicious= severity @_severity_probed_suspicious = severity if valid_entry?(severity, SEVERITIES) end |
#to_controlled_hash ⇒ Object
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/contrast/agent/reporting/settings/syslog.rb', line 172 def to_controlled_hash { syslogEnabled: enable, syslogIpAddress: ip, syslogPortNumber: port, syslogFacilityCode: facility, syslogConnectionType: connection_type, syslogProtocol: protocol, syslogSeverityExploited: severity_exploited, syslogSeverityBlocked: severity_blocked, syslogSeverityProbed: severity_probed, syslogSeveritySuspicious: severity_probed_suspicious, syslogSeverityBlockedPerimeter: severity_blocked_perimeter, syslogSeverityProbedPerimeter: severity_probed_perimeter } end |