Skip to main content

Log

The entries of the systemd journal. osapi dsl behavior get --name log and osapi dsl behavior method get show the same.

Behavior​

Namelog
DescriptionThe entries of the systemd journal
Placementnode
Arealogs
Internalno
APIyes
CLIyes
Nextno
Platformslinux
Sudonone
Runsnone
Writesnone
Keeps stateno
Usesnone
Used bynone

Methods (1)​

NAMEVERBHTTPROUTEPERMISSIONDESCRIPTION
listreadGET/api/node/{hostname}/loglog:readList the entries of the journal

Types (1)​

NAMEINPUTOUTPUT
listListInput { unit, lines, since, priority }[]Entry { timestamp, unit, priority, message, pid }

Settings (0)​

None. Declare them with behavior.Config.

Telemetry​

Spanbehavior.log.<method>
Child spansexec journalctl
Metricsosapi_behavior_calls_total, osapi_behavior_duration_seconds, osapi_behavior_changes_total
Attributesosapi.behavior.name, osapi.behavior.method, osapi.behavior.verb, osapi.behavior.outcome, osapi.behavior.changed
Recorded inputsnone

Method list​

Namelist
Verbread
DescriptionList the entries of the journal
DetailRuns journalctl --output=json, the newest entries last: the last 100 unless lines says, of one unit when unit says, since a time when since says, and at a priority or above when priority says. A priority is its name, such as err or info. The hand-written log domain read the Debian family only; this reads each Linux host that has journald.
HTTPGET
Route/api/node/{hostname}/log
Permissionlog:read
Commandosapi client node log list
Input typeListInput
Output type[]Entry

Input (4)​

FIELDTYPEREQUIREDCONSTRAINTSDESCRIPTION
unitstringnopattern ^[a-zA-Z0-9:_.@-]+$Only the entries of this systemd unit, such as nginx.service
linesintegernomin 1, max 10000How many of the newest entries; 100 when it is not set
sincestringnoOnly the entries since this time, in any form that journalctl --since takes, such as 1 hour ago
prioritystringnoone of emerg alert crit err warning notice info debugOnly the entries at this priority or above

Output (5)​

FIELDTYPEDESCRIPTION
timestampstringWhen journald recorded it, in RFC 3339
unitstringThe syslog identifier that wrote it
prioritystringIts priority, by name. An entry that journald has no priority for has none
messagestringThe message
pidintegerThe process that wrote it

Examples (2)​

EXAMPLEINPUTOUTPUT
The newest entries(none)[message=Started nginx, pid=1234, priority=info, timestamp=2024-03-31T23:50:45.123456Z, unit=nginx] [message=Accepted key, pid=5678, priority=notice, timestamp=2024-03-31T23:50:46Z, unit=sshd]
The last entry of one unit at info or aboveunit=nginx.service, lines=1, since=1 hour ago, priority=info[message=Started nginx, pid=1234, priority=info, timestamp=2024-03-31T23:50:45.123456Z, unit=nginx]