Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Group = endpoint.Define( "source", "The sources that write to the systemd journal", endpoint.Area(area.Logs), endpoint.Prefix("node/{hostname}/log"), endpoint.Uses[dispatch.Deps](), endpoint.Tag("source_operations", "Log source", "The sources that write to the systemd journal"), endpoint.CommandNotes("The [source behavior](../../../../../../reference/behaviors/logs/log/source/source.md) page tells where the behavior runs, what it is built on and its settings."), endpoint.Doc[types.RowStatus](dispatch.RowStatusDoc), endpoint.Get[ListRequest, LogSourceCollectionResponse]("list"). Handle(HandleList). ID("GetNodeLogSource"). Describe("List the sources of the journal"). Permission("log:read"). Returns("Each target host's result."). Explain("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."). Example("--target web-01", "The sources"). Result("The sources, on one host:\n\n```ansi\n$ osapi client node log source list --target web-01\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mNAME\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m \x1b[1mcron\x1b[0m\n \x1b[38;2;138;138;138mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m \x1b[1mnginx\x1b[0m\n \x1b[38;2;138;138;138mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m \x1b[1msshd\x1b[0m\n\n 1 host: \x1b[38;2;103;234;147m1 ok\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n```\n\nOn each host, where one cannot run it:\n\n```ansi\n$ osapi client node log source list --target _all\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n \x1b[38;2;10;143;176mHOSTNAME \x1b[0m\x1b[38;2;10;143;176mSTATUS \x1b[0m\x1b[38;2;10;143;176mNAME\x1b[0m\n \x1b[1mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m \x1b[1mcron\x1b[0m\n \x1b[38;2;138;138;138mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m \x1b[1mnginx\x1b[0m\n \x1b[38;2;138;138;138mweb-01\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m \x1b[1msshd\x1b[0m\n \x1b[1mweb-02\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m \x1b[1mcron\x1b[0m\n \x1b[38;2;138;138;138mweb-02\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m \x1b[1mnginx\x1b[0m\n \x1b[38;2;138;138;138mweb-02\x1b[0m \x1b[38;2;103;234;147mok\x1b[0m \x1b[1msshd\x1b[0m\n\n 3 hosts: \x1b[38;2;103;234;147m2 ok\x1b[0m, \x1b[38;5;222m1 skipped\x1b[0m \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n\n\x1b[1;38;2;255;0;255mDetails:\x1b[0m\n \x1b[1mmac-01\x1b[0m \x1b[38;5;222mskipped\x1b[0m operation not supported on this OS family\n```\n\nWith `--json`, the API's response:\n\n```json\n{\n \"job_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"results\": [\n {\n \"hostname\": \"web-01\",\n \"name\": \"cron\",\n \"status\": \"ok\"\n },\n {\n \"hostname\": \"web-01\",\n \"name\": \"nginx\",\n \"status\": \"ok\"\n },\n {\n \"hostname\": \"web-01\",\n \"name\": \"sshd\",\n \"status\": \"ok\"\n }\n ]\n}\n```"). Errors(endpoint.NotFound(behavior.ErrNotFound, "The host does not have what the request names, such as the object of a deploy."), endpoint.Conflict(behavior.ErrNotManaged, "osapi did not deploy the item, so it does not change it, or the host does not have a program that the method needs.").Because(types.ReasonNotManaged), endpoint.Conflict(behavior.ErrNotInstalled, "osapi did not deploy the item, so it does not change it, or the host does not have a program that the method needs.").Because(types.ReasonNotInstalled), endpoint.Invalid(dispatch.ErrInvalid, "The request is not valid, or the host refuses the input, such as a path that is a directory.")), )
Group is source as an endpoint group, which its spec comes from.
Functions ¶
Types ¶
type ListRequest ¶
type ListRequest struct {
Hostname string `` /* 182-byte string literal not displayed */
}
ListRequest is the request of source list: its target and its input.
type LogSourceCollectionResponse ¶
type LogSourceCollectionResponse struct {
JobID string `` /* 133-byte string literal not displayed */
Results []LogSourceSource `json:"results"`
}
LogSourceCollectionResponse is each target host's result.
func HandleList ¶
func HandleList( ctx context.Context, d dispatch.Deps, in ListRequest, ) (LogSourceCollectionResponse, error)
HandleList runs source list on the target, for the endpoint server.
type LogSourceSource ¶
type LogSourceSource struct {
Hostname string `doc:"Hostname of the agent that produced this result." json:"hostname"`
Status types.RowStatus `doc:"The status of the operation for this host." json:"status"`
Name *string `doc:"The syslog identifier, such as sshd" json:"name,omitempty"`
Error *string `doc:"Error message if the agent failed." json:"error,omitempty"`
}
LogSourceSource is the result of source on one host.