Skip to main content

LogSource

c.LogSource calls the API's LogSource group. The sources that write to the systemd journal.

Methods​

MethodReturnsPermissionDescription
List(ctx, hostname)*Response[Collection[LogSourceSource]]log:readList the sources of the journal.

List​

func (s *LogSourceService) List(
ctx context.Context,
hostname string,
) (*Response[Collection[LogSourceSource]], error)

List the sources of the journal.

Runs journalctl --field=SYSLOG_IDENTIFIER: each syslog identifier that has an entry, once, sorted. A name here is what log list takes as unit when the source is a systemd unit.

It sends GET /api/node/{hostname}/log/source, and needs the permission log:read.

The examples of the method's definition:

The sources, go run log_source.go list:

resp, err := c.LogSource.List(ctx, target)

Types​

The fields of each type are the properties of its schema in the API's spec.

LogSourceSource​

FieldTypeDescription
ErrorstringError message if the agent failed.
HostnamestringHostname of the agent that produced this result.
NamestringThe syslog identifier, such as sshd.
StatusRowStatusWhat happened on the host: ok, the operation ran and succeeded; failed, it ran and did not succeed; skipped, the host's OS family does not support it; timeout, the host did not answer, so nobody knows whether it ran.

RowStatus​

What happened on the host: ok, the operation ran and succeeded; failed, it ran and did not succeed; skipped, the host's OS family does not support it; timeout, the host did not answer, so nobody knows whether it ran.

A string, one of ok, failed, skipped, timeout.

Example​

examples/sdk/client/log_source.go runs each example of this page. With no argument, it lists them.