Class: AiRootShield::Enterprise::SyslogChannel
- Inherits:
-
Object
- Object
- AiRootShield::Enterprise::SyslogChannel
- Defined in:
- lib/ai_root_shield/enterprise/alert_system.rb
Overview
Syslog channel implementation
Instance Method Summary collapse
-
#initialize(config) ⇒ SyslogChannel
constructor
A new instance of SyslogChannel.
- #send_alert(alert) ⇒ Object
Constructor Details
#initialize(config) ⇒ SyslogChannel
Returns a new instance of SyslogChannel.
362 363 364 |
# File 'lib/ai_root_shield/enterprise/alert_system.rb', line 362 def initialize(config) @config = config end |
Instance Method Details
#send_alert(alert) ⇒ Object
366 367 368 369 370 371 372 373 374 375 376 377 |
# File 'lib/ai_root_shield/enterprise/alert_system.rb', line 366 def send_alert(alert) return { success: false, error: "Syslog not available" } unless Syslog.opened? priority = map_severity_to_syslog(alert[:severity]) = (alert) Syslog.log(priority, ) { success: true, channel: 'syslog', timestamp: Time.now.utc.iso8601 } rescue StandardError => e { success: false, error: e., channel: 'syslog' } end |