Class: Pvectl::Commands::Logs::Handlers::Syslog

Inherits:
Object
  • Object
show all
Includes:
ResourceHandler
Defined in:
lib/pvectl/commands/logs/handlers/syslog.rb,
sig/pvectl/commands/logs/handlers/syslog.rbs

Overview

Handler for node syslog output.

Fetches syslog entries from a node via Repositories::Syslog. Supports filtering by service name and time range.

Examples:

Using via registry

handler = Logs::ResourceRegistry.for("node")
entries = handler.list(node: "pve1", service: "pvedaemon")

See Also:

Instance Method Summary collapse

Constructor Details

#initialize(repository: nil) ⇒ Syslog

Returns a new instance of Syslog.

Parameters:



22
23
24
# File 'lib/pvectl/commands/logs/handlers/syslog.rb', line 22

def initialize(repository: nil)
  @repository = repository
end

Instance Method Details

#list(node:, limit: 50, since: nil, until_time: nil, service: nil, **_) ⇒ Array[Models::SyslogEntry]

Parameters:

  • node: (String)
  • limit: (Integer) (defaults to: 50)
  • since: (String, nil) (defaults to: nil)
  • until_time: (String, nil) (defaults to: nil)
  • service: (String, nil) (defaults to: nil)
  • (Object)

Returns:



26
27
28
29
# File 'lib/pvectl/commands/logs/handlers/syslog.rb', line 26

def list(node:, limit: 50, since: nil, until_time: nil, service: nil, **_)
  repository.list(node: node, limit: limit, since: since,
                  until_time: until_time, service: service)
end

#presenterPresenters::SyslogEntry



31
32
33
# File 'lib/pvectl/commands/logs/handlers/syslog.rb', line 31

def presenter
  Presenters::SyslogEntry.new
end

#repositoryRepositories::Syslog



37
38
39
40
41
42
43
44
# File 'lib/pvectl/commands/logs/handlers/syslog.rb', line 37

def repository
  @repository ||= begin
    config_service = Pvectl::Config::Service.new
    config_service.load
    connection = Pvectl::Connection.new(config_service.current_config)
    Repositories::Syslog.new(connection)
  end
end