langchain_community.document_loaders.datadog_logs.DatadogLogsLoader¶

class langchain_community.document_loaders.datadog_logs.DatadogLogsLoader(query: str, api_key: str, app_key: str, from_time: Optional[int] = None, to_time: Optional[int] = 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 – The query to run in Datadog.

  • api_key – The Datadog API key.

  • app_key – The Datadog APP key.

  • from_time – 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 – Optional. The end of the time range to query. Supports date math and regular timestamps (milliseconds) like ‘1688732708951’ Defaults to now.

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

Methods

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

Initialize Datadog document loader.

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: Optional[int] = None, to_time: Optional[int] = 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 – The query to run in Datadog.

  • api_key – The Datadog API key.

  • app_key – The Datadog APP key.

  • from_time – 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 – Optional. The end of the time range to query. Supports date math and regular timestamps (milliseconds) like ‘1688732708951’ Defaults to now.

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

lazy_load() Iterator[Document]¶

A lazy loader for Documents.

load() List[Document][source]¶

Get logs from Datadog.

Returns

A list of Document objects.
  • page_content

  • metadata
    • id

    • service

    • status

    • tags

    • timestamp

load_and_split(text_splitter: Optional[TextSplitter] = None) List[Document]¶

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

Parameters

text_splitter – TextSplitter instance to use for splitting documents. Defaults to RecursiveCharacterTextSplitter.

Returns

List of Documents.

parse_log(log: dict) Document[source]¶

Create Document objects from Datadog log items.

Examples using DatadogLogsLoader¶