adp.core.loganalytics.LogAnalyticsClient
- class adp.core.loganalytics.LogAnalyticsClient(log_analytics_endpoint_uri: str, log_analytics_dcr_id: str, log_analytics_stream_name: str, tenant_id: str, client_id: str, client_secret: str)
Class to communicate with loganalytics
- __init__(log_analytics_endpoint_uri: str, log_analytics_dcr_id: str, log_analytics_stream_name: str, tenant_id: str, client_id: str, client_secret: str)
__init__ Creates LogAnalyticsClient.
Client which is able to post data to Azure Log Analytics.
- Parameters:
log_analytics_endpoint_uri (str) – The logging adres of the Data Collection Endpoint. Copy this from the Azure portal.
log_analytics_dcr_id (str) – The Immutable ID of the Data Collection Rule. Copy this from the Azure portal.
log_analytics_stream_name (str) – The name of Data Source of the DCR. Copy from the tab Data Sources in Azure Portal.
tenant_id (str) – The tenant_id. Copy from the tab Data Sources in Azure Portal.
client_id (str) – The client_id of the spn autherized for logging. Copy from the tab Data Sources in Azure Portal.
client_secret (str) – The client_id of the spn autherized for logging. Copy from the tab Data Sources in Azure Portal.
Methods
__init__(log_analytics_endpoint_uri, ...)__init__ Creates LogAnalyticsClient.
post_data(environment, level, timestamp, ...)Posts data to Log Analytics
- post_data(environment: str, level: str, timestamp: float, message: str, remainder: Dict[str, Any], created: float, name: str, msg: str, levelname: str, levelno: int, pathname: str, filename: str, module: str, exc_text: str, stack_info: str, lineno: int, funcName: str, msecs: float, relativeCreated: float, threadName: str, thread: int, processName: str, process: int, taskName: str)
Posts data to Log Analytics
Body can be any object that is serializable as a JSON formatted string.
- Parameters:
body (Any) – Object to serialize to JSON formatted string