.agents/skills/query-agent-events/transports.md
Three ways to query agent-events. The first two are scripted in this skill; the third is operator-only.
All three speak the same systemd-journal Function. The
payload shape (after, before, last, query, facets,
histogram, __logs_sources, selections, ...) is identical
across transports. The Function payload is documented once at:
<repo>/docs/netdata-ai/skills/query-netdata-cloud/query-logs.mdThat doc is the canonical reference for:
selections multi-value field-filter (AND across
fields, OR across values) -- this skill leans on it heavily,data rows, columns map,
facets, histogram, etc.).This skill EXTENDS that doc with agent-events specifics: which
AE_* fields are best as facets, what default selections
predicate to use, what __logs_sources value to set.
POST https://${NETDATA_CLOUD_HOSTNAME}/api/v2/nodes/${AGENT_EVENTS_NODE_ID}/function?function=systemd-journal
Auth: Authorization: Bearer ${NETDATA_CLOUD_TOKEN}.
source "$(git rev-parse --show-toplevel)/.agents/skills/query-netdata-cloud/scripts/_lib.sh"
cloud_load_env
cloud_query \
"/api/v2/nodes/${AGENT_EVENTS_NODE_ID}/function?function=systemd-journal" \
"$PAYLOAD"
Or the query-netdata-agents skill's wrapper, which works
identically and routes through Cloud when configured:
source "$(git rev-parse --show-toplevel)/.agents/skills/query-netdata-agents/scripts/_lib.sh"
agents_load_env
agents_call_function "$AGENT_EVENTS_NODE_ID" systemd-journal "$PAYLOAD"
NETDATA_CLOUD_TOKEN; works from any network.POST http://${AGENT_EVENTS_HOSTNAME}:19999/api/v3/function?function=systemd-journal
Auth: bearer token minted from the Cloud token. The
agents_query_agent helper handles minting + caching
transparently.
source "$(git rev-parse --show-toplevel)/.agents/skills/query-netdata-agents/scripts/_lib.sh"
agents_load_env
agents_query_agent \
--node "$AGENT_EVENTS_NODE_ID" \
--host "$AGENT_EVENTS_HOSTNAME:19999" \
--machine-guid "$AGENT_EVENTS_MACHINE_GUID" \
POST '/api/v3/function?function=systemd-journal' "$PAYLOAD"
Output is the response body only. The bearer never reaches the assistant's captured stdout.
This skill does NOT ship a scripted ssh transport. The
operator (Costa) sometimes runs journalctl directly on the
host:
ssh "$AGENT_EVENTS_HOSTNAME" \
sudo /usr/bin/journalctl --namespace=agent-events \
--since '24 hours ago' -o json
Notes:
${AGENT_EVENTS_HOSTNAME} (env-keyed; can be
an IP or DNS name). The journal namespace is agent-events
(hardcoded constant, set on the ingestion server's log2journal
invocation, NOT a function of the hostname).journalctl does NOT support multi-value field filters
(they are a Netdata-engine feature, not journald). If you
need AND-of-OR filtering, use transport 1 or 2.systemd-journal
group on the ingestion host. Most team members do not have
this. Use transports 1 or 2 instead.__logs_sources valueAlways set __logs_sources to the agent-events namespace name
("agent-events" -- a hardcoded constant set on the ingestion
server's log2journal invocation; NOT derived from
${AGENT_EVENTS_HOSTNAME}):
{ "__logs_sources": "agent-events" }
Without this, the Function defaults to all-local-logs on the ingestion-server agent -- which is huge and unrelated.
selections for agent-eventsFor the agent-events namespace, the most-useful index-friendly predicates (always present on every record):
AE_VERSION -- schema version anchor (always 28+).AE_AGENT_HEALTH -- crash class (filter to crash-* for crashes).AE_EXIT_CAUSE -- exit reason (filter to specific causes).AE_AGENT_VERSION -- producing agent version (regression slicing).AE_FATAL_SIGNAL_CODE -- non-empty for signal crashes.AE_FATAL_FUNCTION / AE_FATAL_FILENAME -- localize to a
function or file.AE_HOST_ARCHITECTURE / AE_OS_FAMILY / AE_AGENT_INSTALL_TYPE
-- arch / distro / packaging slicers.AE_AGENT_PROFILE_0 -- standalone / parent / child / iot.AE_AGENT_KUBERNETES -- k8s-specific.AE_AGENT_ACLK -- cloud-claimed vs not.See AE_FIELDS.md for the full field map and enum meanings.
<repo>/docs/netdata-ai/skills/query-netdata-cloud/query-logs.md
-- canonical Function payload shape and the selections
multi-value filter section.<repo>/docs/netdata-ai/skills/query-netdata-agents/query-logs.md
-- direct-agent transport details.query-discipline.md (this skill) -- how to compose
index-friendly queries against agent-events.update-cadence.md (this skill) -- when events arrive and why.