UniFi Network API (v2) — system log.
Returns the controller's structured system log: device adoption,
firmware updates, gateway events, threat-management actions, etc. This
is more focused than UnifiApi.Network.Events — events covers all
client/AP activity, system log covers controller-level operations.
Requires cookie + CSRF authentication. See UnifiApi.Auth.Cookie.
Common entry fields
id,timestamp,category,levelkey,subsystemdescription— human-readable messagedevice— when the log line is device-attributed
Summary
Functions
Returns all system log entries within the supported window.
Returns a lazy stream that auto-paginates the system log via
pageSize / pageNumber.
Functions
@spec list_all(Req.Request.t(), String.t(), keyword()) :: {:ok, term()} | {:error, UnifiApi.Error.t()}
Returns all system log entries within the supported window.
Options
:limit— server-side cap (pageSizequery param). Default 200 (reduced from 500 in v0.4.0 to bound per-page memory).:start— bucket start (pageNumberquery param).:raw— whentrue, return the raw response body binary (skips JSON decoding) — useful for streaming parsers on very large logs.
@spec stream(Req.Request.t(), String.t(), keyword()) :: Enumerable.t()
Returns a lazy stream that auto-paginates the system log via
pageSize / pageNumber.
Error contract
A mid-stream error does not raise by default: the stream halts and
yields {:error, %UnifiApi.StreamError{}, last_page} as its final
element, so the enumerable is heterogeneous. Match the tail:
case Enum.to_list(stream) do
items when is_list(items) ->
case List.last(items) do
{:error, error, cursor} -> {:error, error, cursor}
_ -> {:ok, items}
end
endPass raise_errors: true to raise UnifiApi.StreamError instead.
Options
:limit— page size (default 200, reduced from 500 in v0.4.0 to bound per-page memory), sent aspageSize.:max_pages— halt after this many successful pages (default: unbounded).:max_items— halt once this many entries have been yielded; the final page is truncated to fit (default: unbounded).:raise_errors— whentrue, raiseUnifiApi.StreamErroron a mid-stream error instead of yielding{:error, reason, last_page}as the final element (default:false).
:max_pages, :max_items and :raise_errors are forwarded verbatim
to UnifiApi.Client.stream_paged/2 and behave exactly as they do in
UnifiApi.Client.stream/3. Any other key raises ArgumentError.
Examples
# The 500 most recent entries, without walking the whole log
UnifiApi.Network.SystemLog.stream(authed, "default", max_items: 500)
|> Enum.to_list()