DatadogLogsLoader#

class langchain_community.document_loaders.datadog_logs.DatadogLogsLoader(query: str, api_key: str, app_key: str, from_time: int | None = None, to_time: int | None = None, limit: int = 100)[source]#

Load Datadog logs.

Logs are written into the page_content and into the metadata.

Initialize Datadog document loader.

Requirements:
  • Must have datadog_api_client installed. Install with pip install datadog_api_client.

Parameters:
  • query (str) – The query to run in Datadog.

  • api_key (str) – The Datadog API key.

  • app_key (str) – The Datadog APP key.

  • from_time (int | None) – Optional. The start of the time range to query. Supports date math and regular timestamps (milliseconds) like ‘1688732708951’ Defaults to 20 minutes ago.

  • to_time (int | None) – Optional. The end of the time range to query. Supports date math and regular timestamps (milliseconds) like ‘1688732708951’ Defaults to now.

  • limit (int) – The maximum number of logs to return. Defaults to 100.

Methods

__init__(query, api_key, app_key[, ...])

Initialize Datadog document loader.

alazy_load()

A lazy loader for Documents.

aload()

Load data into Document objects.

lazy_load()

A lazy loader for Documents.

load()

Get logs from Datadog.

load_and_split([text_splitter])

Load Documents and split into chunks.

parse_log(log)

Create Document objects from Datadog log items.

__init__(query: str, api_key: str, app_key: str, from_time: int | None = None, to_time: int | None = None, limit: int = 100) → None[source]#

Initialize Datadog document loader.

Requirements:
  • Must have datadog_api_client installed. Install with pip install datadog_api_client.

Parameters:
  • query (str) – The query to run in Datadog.

  • api_key (str) – The Datadog API key.

  • app_key (str) – The Datadog APP key.

  • from_time (int | None) – Optional. The start of the time range to query. Supports date math and regular timestamps (milliseconds) like ‘1688732708951’ Defaults to 20 minutes ago.

  • to_time (int | None) – Optional. The end of the time range to query. Supports date math and regular timestamps (milliseconds) like ‘1688732708951’ Defaults to now.

  • limit (int) – The maximum number of logs to return. Defaults to 100.

Return type:

None

async alazy_load() → AsyncIterator[Document]#

A lazy loader for Documents.

Return type:

AsyncIterator[Document]

async aload() → List[Document]#

Load data into Document objects.

Return type:

List[Document]

lazy_load() → Iterator[Document]#

A lazy loader for Documents.

Return type:

Iterator[Document]

load() → List[Document][source]#

Get logs from Datadog.

Returns:

A list of Document objects.
  • page_content

  • metadata
    • id

    • service

    • status

    • tags

    • timestamp

Return type:

List[Document]

load_and_split(text_splitter: TextSplitter | None = None) → List[Document]#

Load Documents and split into chunks. Chunks are returned as Documents.

Do not override this method. It should be considered to be deprecated!

Parameters:

text_splitter (Optional[TextSplitter]) – TextSplitter instance to use for splitting documents. Defaults to RecursiveCharacterTextSplitter.

Returns:

List of Documents.

Return type:

List[Document]

parse_log(log: dict) → Document[source]#

Create Document objects from Datadog log items.

Parameters:

log (dict) –

Return type:

Document

Examples using DatadogLogsLoader