pub struct LogsApi<'a> { /* private fields */ }Expand description
Logs API façade.
Implementations§
Source§impl<'a> LogsApi<'a>
impl<'a> LogsApi<'a>
Sourcepub fn new(client: &'a DatadogClient) -> Self
pub fn new(client: &'a DatadogClient) -> Self
Wraps an existing DatadogClient for log operations.
Sourcepub async fn search(
&self,
query: &str,
from: &str,
to: &str,
limit: usize,
sort: SortOrder,
after: Option<&str>,
) -> Result<LogSearchResult>
pub async fn search( &self, query: &str, from: &str, to: &str, limit: usize, sort: SortOrder, after: Option<&str>, ) -> Result<LogSearchResult>
Searches log events.
from and to are passed through to Datadog as strings. Datadog
accepts ISO 8601 timestamps, epoch milliseconds, and relative
shorthand like now-15m / now; callers are expected to convert
CLI-level inputs into a form Datadog understands before calling.
Returns a single page only. When after is Some, Datadog
resumes pagination at that cursor token (page.cursor in the
request body). The next-page token is preserved on
meta.page.after of the response so the caller (or
LogsApi::search_all) can iterate.
limit is rejected client-side when it exceeds MAX_PAGE_LIMIT.
Sourcepub async fn search_all(
&self,
query: &str,
from: &str,
to: &str,
limit: usize,
sort: SortOrder,
) -> Result<LogSearchResult>
pub async fn search_all( &self, query: &str, from: &str, to: &str, limit: usize, sort: SortOrder, ) -> Result<LogSearchResult>
Searches log events, auto-paginating via cursor as needed.
limit == 0 means “fetch every match up to HARD_CAP”. Any
non-zero limit is upper-bounded by HARD_CAP to keep a single
invocation from issuing more than 10k items’ worth of requests.
Per-request page size is clamped to MAX_PAGE_LIMIT.
Termination follows cursor-pagination semantics: the loop stops
when the response omits meta.page.after (Datadog signals “no
more pages” only via the absent cursor — a short page on its own
is not a terminator) or when cap items have been collected.
The returned envelope keeps the meta block from the last
successful page so the response’s cursor reflects the iterator’s
final position (typically None when the API is exhausted).