### Log Alert Configuration Example Source: https://github.com/logzio/logz-api/blob/master/docs/logz/search-unified-alerts.api.mdx An example of a log alert configuration, including query and filters. ```json { "type": "LOG_ALERT", "suppressNotificationsMinutes": 10, "alertOutputTemplateType": "JSON", "searchTimeFrameMinutes": 5, "subComponents": [ { "queryDefinition": { "query": "error OR exception", "filters": { "bool": } } } ] } ``` -------------------------------- ### Start Local Development Server Source: https://github.com/logzio/logz-api/blob/master/README.md Start a local build of the Logz API documentation site using Docusaurus. ```bash yarn start ``` -------------------------------- ### Metric Alert Example Source: https://github.com/logzio/logz-api/blob/master/docs/logz/search-unified-alerts.api.mdx A complete example of a metric alert configuration. ```json { "type": "METRIC_ALERT", "severity": "MEDIUM", "trigger": { "type": "threshold", "pendingPeriod": 15, "condition": { "operatorType": "above", "threshold": 100 } }, "queries": [ { "refId": "A", "queryDefinition": { "accountId": 12345, "promqlQuery": "avg(cpu.usage) by (host)" } } ] } ``` -------------------------------- ### Example Response for Get All Detailed Time-Based Account Source: https://github.com/logzio/logz-api/blob/master/docs/logz/get-all-detailed-time-based-account.api.mdx This JSON object represents a sample response from the API, detailing the structure and types of data returned for account information. ```json [ { "subAccountRelation": { "ownerAccountId": 88765, "subAccountId": 89234, "searchable": true, "accessible": false, "createdDate": 1627489797000, "lastUpdatedDate": 1627489797000, "lastUpdaterUserId": 33342, "type": "SUB_ACCOUNT" }, "account": { "accountId": 0, "accountName": "string", "accountToken": "string", "active": true, "esIndexPrefix": "string", "isFlexible": true, "reservedDailyGB": 3, "maxDailyGB": 5, "retentionDays": 0, "softLimitGB": 0 }, "sharingObjectsAccounts": [ { "accountId": 0, "accountName": "string", "accountToken": "string", "active": true, "esIndexPrefix": "string", "isFlexible": true, "reservedDailyGB": 3, "maxDailyGB": 5, "retentionDays": 0, "softLimitGB": 0 } ], "utilizationSettings": { "frequencyMinutes": 5, "utilizationEnabled": true }, "dailyUsagesList": { "usage": [ { "date": 0, "bytes": 0 } ] }, "docSizeSetting": true, "snapsearchRetentionDays": 7 } ] ``` -------------------------------- ### Metric Query Model Example Source: https://github.com/logzio/logz-api/blob/master/docs/logz/search-unified-alerts.api.mdx An example of a metric query model, including account ID and PromQL query. ```json { "refId": "A", "queryDefinition": { "accountId": 12345, "promqlQuery": "avg(cpu.usage) by (host)" } } ``` -------------------------------- ### Threshold Operator Examples Source: https://github.com/logzio/logz-api/blob/master/docs/logz/search-unified-alerts.api.mdx Examples of different threshold operators for metric triggers. ```json { "operatorType": "above", "threshold": 100 } ``` ```json { "operatorType": "below", "threshold": 50 } ``` ```json { "operatorType": "within_range", "minThreshold": 50, "maxThreshold": 100 } ``` ```json { "operatorType": "outside_range", "minThreshold": 10, "maxThreshold": 50 } ``` -------------------------------- ### Alert Creation Example Source: https://github.com/logzio/logz-api/blob/master/docs/logz/create-alert.api.mdx This is a comprehensive example of an alert payload, demonstrating various configuration options including query definition, trigger conditions, output formatting, correlation rules, and scheduling. ```json { "id": 627816, "updatedAt": "2020-04-02T18:58:16.000Z", "updatedBy": "tomer@logz.io", "createdAt": "2020-02-02T18:58:16.000Z", "createdBy": "tomer@logz.io", "enabled": true, "title": "Excessive WARN levels in PROD", "description": "Steps to remediate...", "tags": [ "network", "aws" ], "output": { "recipients": { "emails": [ "tom.a@logz.io" ], "notificationEndpointIds": [ 0 ] }, "suppressNotificationsMinutes": 60, "type": "JSON" }, "searchTimeFrameMinutes": 0, "subComponents": [ { "queryDefinition": { "query": "type:apache_access", "filters": { "bool": { "must": [ { "match_phrase": { "Field": { "query": "value" } } } ], "must_not": [ { "match_phrase": { "Field": { "query": "value" } } } ] } }, "groupBy": [ "string" ], "aggregation": { "aggregationType": "SUM", "fieldToAggregateOn": "string", "valueToAggregateOn": "string" }, "shouldQueryOnAllAccounts": false, "accountIdsToQueryOn": [ 2321 ] }, "trigger": { "operator": "GREATER_THAN_OR_EQUALS", "severityThresholdTiers": { "MEDIUM": 10, "HIGH": 100, "SEVERE": 300 } }, "output": { "columns": [ { "fieldName": "string", "regex": "string", "sort": "DESC" } ], "shouldUseAllFields": true } } ], "correlations": { "correlationOperators": [ "AND" ], "joins": [ { "0": "region", "1": "region" } ] }, "schedule": { "cronExpression": "string", "timezone": "string" }, "sendToAll": false } ``` -------------------------------- ### Install Docusaurus API Plugin Dependencies Source: https://github.com/logzio/logz-api/blob/master/README.md Install the necessary Docusaurus plugins for API documentation. Run these commands in your project's root directory. ```bash yarn add docusaurus-plugin-openapi-docs ``` ```bash yarn add docusaurus-theme-openapi-docs ``` -------------------------------- ### Example Home Dashboard Response Source: https://github.com/logzio/logz-api/blob/master/docs/logz/get-home-dashboard.api.mdx This JSON object represents a typical response from the get home dashboard API. It includes the dashboard's configuration and metadata, such as its title, editability, and home status. ```json { "dashboard": { "editable": false, "hideControls": false, "nav": { "enable": false, "type": "timepicker" }, "style": "dark", "tags": { "tag": "outage" }, "templating": { "list": [ "string" ] }, "time": {}, "timezone": "browser", "title": "Home", "version": 2 }, "meta": { "isHome": true, "canSave": false, "canEdit": false, "canStar": false, "url": "url", "expires": "0001-01-01T00:00:00Z", "created": "0001-01-01T00:00:00Z" } } ``` -------------------------------- ### Metric Trigger Example (Math) Source: https://github.com/logzio/logz-api/blob/master/docs/logz/search-unified-alerts.api.mdx An example of a metric trigger using a mathematical expression. ```json { "type": "math", "expression": "$A > 100 || ($B < 50 && $C > 75)" } ``` -------------------------------- ### Error Response Example Source: https://github.com/logzio/logz-api/blob/master/docs/logz/create-filter.api.mdx This snippet shows an example of an error response from the Logz.io API, specifically for cases like insufficient privileges. ```APIDOC ## Error Response Example ### Description This example demonstrates a typical error response when a user lacks the necessary permissions to access an API feature. ### Response #### Success Response (e.g., 403 Forbidden) - **message** (string) - A descriptive message indicating the error, such as "Insufficient privileges. Contact our Support team for access to this API feature." ### Response Example ```json { "message": "Insufficient privileges" } ``` ``` -------------------------------- ### Example Account Schema Source: https://github.com/logzio/logz-api/blob/master/docs/logz/get-all.api.mdx This JSON object represents an example of an account's schema, detailing settings like retention days, sharing, utilization, and capacity limits. It's useful for understanding the structure of account data returned by the API. ```json [ { "accountId": 99999, "email": null, "accountName": "404 errors", "retentionDays": 5, "searchable": true, "accessible": false, "docSizeSetting": true, "sharingObjectsAccounts": [ { "accountId": 88888, "accountName": "dev group 8" } ], "utilizationSettings": { "frequencyMinutes": 5, "utilizationEnabled": true }, "isOwner": false, "snapsearchRetentionDays": 7, "isFlexible": true, "reservedDailyGB": 0, "maxDailyGB": 5, "isCapped": false, "totalTimeBasedDailyGB": 5, "sharedGB": 5, "softLimitGB": 0 } ] ``` -------------------------------- ### Get Snapshot API Request Example Source: https://github.com/logzio/logz-api/blob/master/docs/logz/get-snapshot.api.mdx This example demonstrates a typical JSON request body for the Get Snapshot API. It includes parameters for filtering by timestamp, message content, and time frame, along with timezone information. ```json { "query": "e%253A%2528from%253A%25272018-06-02T15", "message": "Hey, let me know if you need me to do anything about this.", "timeFrameFrom": 389836800, "timeFrameTo": 414720000, "snapshotTimeZone": "UTC" } ``` -------------------------------- ### Get All Dashboard Versions Source: https://github.com/logzio/logz-api/blob/master/docs/logz/get-all-dashboard-versions.api.mdx Fetches all versions of a dashboard, with options to limit the number of results and specify a starting version. ```APIDOC ## GET /logz/api/v1/dashboards/{dashboardId}/versions ### Description Retrieves all versions of a specific dashboard. ### Method GET ### Endpoint /logz/api/v1/dashboards/{dashboardId}/versions ### Parameters #### Path Parameters - **dashboardId** (integer) - Required - Dashboard ID. #### Query Parameters - **limit** (integer) - Optional - Maximum number of results to return. - **start** (integer) - Optional - Version to start from when returning queries. ### Response #### Success Response (200) - **id** (integer) - ID. - **dashboardId** (integer) - Dashboard ID. - **parentVersion** (integer) - Dashboard parent version. - **restoredFrom** (integer) - Restored from. - **version** (integer) - Version. - **created** (integer) - Date created. - **createdBy** (string) - Created by. - **message** (string) - Message. #### Response Example ```json { "id": 1, "dashboardId": 2, "parentVersion": 0, "restoredFrom": 0, "version": 2, "created": "2017-06-08T17:24:33-04:00\"", "createdBy": "admin", "message": "Initial save" } ``` ``` -------------------------------- ### Example Account Settings Response Source: https://github.com/logzio/logz-api/blob/master/docs/logz/get-settings-for-account.api.mdx A sample JSON response illustrating the structure of account settings, including enabled status, compression, and detailed configurations for both S3 and Azure Blob Storage. ```json { "id": 323, "settings": { "storageType": "S3", "enabled": true, "compressed": true, "amazonS3StorageSettings": { "credentialsType": "IAM", "path": "string", "s3SecretCredentials": { "accessKey": "string", "secretKey": "string" }, "s3IamCredentials": { "arn": "string" } }, "azureBlobStorageSettings": { "tenantId": "string", "clientId": "string", "clientSecret": "string", "accountName": "string", "containerName": "string", "path": "string" } } } ``` -------------------------------- ### Get Snapshot Request Source: https://github.com/logzio/logz-api/blob/master/docs/logz/get-snapshot.api.mdx This snippet shows an example of a request to retrieve snapshot data. It includes parameters for time frame and time zone. ```APIDOC ## GET /logzio/logz-api/snapshot ### Description Retrieves snapshot data from the Logz API. This endpoint allows users to specify a time frame and time zone for the snapshot. ### Method GET ### Endpoint /logzio/logz-api/snapshot ### Parameters #### Query Parameters - **timeFrameFrom** (integer) - Required - The start of the time frame for the snapshot. - **timeFrameTo** (integer) - Required - The end of the time frame for the snapshot. - **snapshotTimeZone** (string) - Required - The time zone for the snapshot (e.g., "UTC"). ### Request Example ```json { "message": "Hey, let me know if you need me to do anything about this.", "timeFrameFrom": 389836800, "timeFrameTo": 414720000, "snapshotTimeZone": "UTC" } ``` ### Response #### Success Response (200) - **message** (string) - Description of the snapshot. - **timeFrameFrom** (integer) - The start of the time frame for the snapshot. - **timeFrameTo** (integer) - The end of the time frame for the snapshot. - **snapshotTimeZone** (string) - The time zone of the snapshot. #### Response Example ```json { "message": "Hey, let me know if you need me to do anything about this.", "timeFrameFrom": 389836800, "timeFrameTo": 414720000, "snapshotTimeZone": "UTC" } ``` ``` -------------------------------- ### Get Lookup List by ID Source: https://github.com/logzio/logz-api/blob/master/docs/logz/get-lookup-list.api.mdx Fetches a lookup list using its GUID. This operation returns the list's ID, name, and description. ```APIDOC ## GET /1/lookups/{id} ### Description Retrieves a specific lookup list by its unique identifier (GUID). ### Method GET ### Endpoint /1/lookups/{id} ### Parameters #### Path Parameters - **id** (string) - Required - GUID of the lookup list. ### Response #### Success Response (200) - **id** (string) - GUID of the lookup list. - **name** (string) - Name of the lookup list. Possible values: `non-empty` and `<= 40 characters`. - **description** (string) - Description of the lookup list. Possible values: `<= 400 characters`. #### Response Example ```json { "id": "7c985e09-3db6-5dc6-ae33-58403493e13f", "name": "string", "description": "string" } ``` ``` -------------------------------- ### Alert Configuration Example Source: https://github.com/logzio/logz-api/blob/master/docs/logz/get-alert.api.mdx This JSON object represents a sample alert configuration, showing all possible fields and their structure. It includes details about the alert's title, description, tags, output recipients, search time frame, sub-components with query definitions and triggers, correlations, and scheduling. ```json { "id": 627816, "updatedAt": "2020-04-02T18:58:16.000Z", "updatedBy": "tomer@logz.io", "createdAt": "2020-02-02T18:58:16.000Z", "createdBy": "tomer@logz.io", "enabled": true, "title": "Excessive WARN levels in PROD", "description": "Steps to remediate...", "tags": [ "network", "aws" ], "output": { "recipients": { "emails": [ "tom.a@logz.io" ], "notificationEndpointIds": [ 0 ] }, "suppressNotificationsMinutes": 60, "type": "JSON" }, "searchTimeFrameMinutes": 0, "subComponents": [ { "queryDefinition": { "query": "type:apache_access", "filters": { "bool": { "must": [ { "match_phrase": { "Field": { "query": "value" } } } ], "must_not": [ { "match_phrase": { "Field": { "query": "value" } } } ] } }, "groupBy": [ "string" ], "aggregation": { "aggregationType": "SUM", "fieldToAggregateOn": "string", "valueToAggregateOn": "string" }, "shouldQueryOnAllAccounts": false, "accountIdsToQueryOn": [ 2321 ] }, "trigger": { "operator": "GREATER_THAN_OR_OR_EQUALS", "severityThresholdTiers": { "MEDIUM": 10, "HIGH": 100, "SEVERE": 300 } }, "output": { "columns": [ { "fieldName": "string", "regex": "string", "sort": "DESC" } ], "shouldUseAllFields": true } } ], "correlations": { "correlationOperators": [ "AND" ], "joins": [ { "0": "region", "1": "region" } ] }, "schedule": { "cronExpression": "string", "timezone": "string" }, "sendToAll": false } ``` -------------------------------- ### Get Series by Labels Source: https://github.com/logzio/logz-api/blob/master/docs/logz/get-series-by-labels.api.mdx Fetches time series that match the provided label selectors within the specified start and end timestamps. You can optionally limit the number of series returned. ```APIDOC ## Get Series by Labels ### Description Retrieves time series data based on label selectors and a time range. ### Method GET ### Endpoint /api/v1/series/by-labels ### Parameters #### Query Parameters - **match[]** (array of strings) - Required - Series selector that selects the series to return. At least one must be provided. - **start** (string) - Required - Start timestamp, inclusive, as an RFC3339 or Unix timestamp. - **end** (string) - Required - End timestamp, inclusive, as an RFC3339 or Unix timestamp. - **limit** (integer) - Optional - Maximum number of returned series. ### Response #### Success Response (200) - **status** (string) - Status of the request (e.g., success, fail). - **data** (array of objects) - An array of objects containing the label name/value pairs which identify each series. #### Response Example ```json { "status": "string", "data": [ {} ] } ``` #### Error Response (400) Invalid request parameters. #### Error Response (500) Internal server error. ``` -------------------------------- ### Get Label Names Source: https://github.com/logzio/logz-api/blob/master/docs/logz/get-label-names.api.mdx Fetches a list of label names. You can filter the results by specifying a time range (`start` and `end` timestamps), a series selector (`match[]`), and a limit on the number of returned label names (`limit`). ```APIDOC ## GET /api/v1/labels ### Description Retrieves a list of label names. Supports filtering by time range, series selector, and result limit. ### Method GET ### Endpoint /api/v1/labels ### Parameters #### Query Parameters - **start** (string) - Optional - Start timestamp, inclusive, as an RFC3339 or Unix timestamp. - **end** (string) - Optional - End timestamp, inclusive, as an RFC3339 or Unix timestamp. - **match[]** (array of strings) - Optional - Series selector to narrow down the series from which to read the label names. - **limit** (integer) - Optional - Maximum number of label names to return. ### Response #### Success Response (200) - **status** (string) - Status of the request (e.g., success, fail). - **data** (array of strings) - A list of label names returned by the API. #### Response Example ```json { "status": "string", "data": [ "string" ] } ``` #### Error Response (400) Invalid request parameters. #### Error Response (500) Internal server error. ``` -------------------------------- ### Account Details Example Source: https://github.com/logzio/logz-api/blob/master/docs/logz/get-detailed-time-based-account.api.mdx This JSON object represents a detailed account configuration, including sub-account relationships, account properties, sharing settings, utilization metrics, and retention policies. ```json { "subAccountRelation": { "ownerAccountId": 88765, "subAccountId": 89234, "searchable": true, "accessible": false, "createdDate": 1627489797000, "lastUpdatedDate": 1627489797000, "lastUpdaterUserId": 33342, "type": "SUB_ACCOUNT" }, "account": { "accountId": 0, "accountName": "string", "accountToken": "string", "active": true, "esIndexPrefix": "string", "isFlexible": true, "reservedDailyGB": 3, "maxDailyGB": 5, "retentionDays": 0, "softLimitGB": 0 }, "sharingObjectsAccounts": [ { "accountId": 0, "accountName": "string", "accountToken": "string", "active": true, "esIndexPrefix": "string", "isFlexible": true, "reservedDailyGB": 3, "maxDailyGB": 5, "retentionDays": 0, "softLimitGB": 0 } ], "utilizationSettings": { "frequencyMinutes": 5, "utilizationEnabled": true }, "dailyUsagesList": { "usage": [ { "date": 0, "bytes": 0 } ] }, "docSizeSetting": true, "snapsearchRetentionDays": 7 } ``` -------------------------------- ### Set up archiving Source: https://github.com/logzio/logz-api/blob/master/docs/logz/create-settings.api.mdx Configure archiving for a time-based log account. One archive can be configured per account (or sub account). ```APIDOC ## Set up archiving ### Description Configure archiving for a time-based log account. One archive can be configured per account (or sub account). For more on this, see [AWS Access with IAM](https://docs.logz.io/user-guide/give-aws-access-with-iam-roles/) and [Archiving](https://docs.logz.io/user-guide/archive-and-restore/configure-archiving.html). ### Method POST ### Endpoint /v1/archiving/settings ### Request Body - **awsAccessKeyId** (string) - Required - The AWS access key ID. - **awsSecretAccessKey** (string) - Required - The AWS secret access key. - **awsRegion** (string) - Required - The AWS region where the bucket is located. - **awsBucketName** (string) - Required - The name of the AWS S3 bucket. - **awsPath** (string) - Optional - The path within the S3 bucket to store the archives. ### Request Example ```json { "awsAccessKeyId": "YOUR_AWS_ACCESS_KEY_ID", "awsSecretAccessKey": "YOUR_AWS_SECRET_ACCESS_KEY", "awsRegion": "us-east-1", "awsBucketName": "your-logz-archive-bucket", "awsPath": "logs/" } ``` ### Response #### Success Response (200) - **message** (string) - A success message indicating that archiving settings have been updated. #### Response Example ```json { "message": "Archiving settings updated successfully." } ``` ``` -------------------------------- ### Set up archiving Source: https://github.com/logzio/logz-api/blob/master/docs/logz/create-settings.api.mdx Configures archiving for a time-based log account. Only one archive can be configured per account or sub-account. ```APIDOC ## POST /v2/archive/settings ### Description Configure archiving for a time-based log account. One archive can be configured per account (or sub-account). ### Method POST ### Endpoint /v2/archive/settings ### Parameters #### Query Parameters - **region** (string) - Required - The region of your account. Please ensure to change the region in the URL to match your account's region. ``` -------------------------------- ### Metric Trigger Example (Threshold) Source: https://github.com/logzio/logz-api/blob/master/docs/logz/search-unified-alerts.api.mdx An example of a metric trigger using a threshold condition. ```json { "type": "threshold", "pendingPeriod": 15, "condition": { "operatorType": "above", "threshold": 100 } } ``` -------------------------------- ### Create a user Source: https://github.com/logzio/logz-api/blob/master/docs/logz/create-user.api.mdx Creates a new user with specified permissions to access your log data. If you run this endpoint with the token of the main account, then you can perform actions on the main account or any sub-account within the main account by providing the sub-account’s accountID. If you run this endpoint with the token of the sub-account, then you can perform actions only on the given sub-account. ```APIDOC ## POST /v1/user-management ### Description Creates a new user with specified permissions to access your log data. If you run this endpoint with the token of the main account, then you can perform actions on the main account or any sub-account within the main account by providing the sub-account’s accountID. If you run this endpoint with the token of the sub-account, then you can perform actions only on the given sub-account. **Note:** Creating users through Logzio API requires email approval and activation of the request. To disable email verification for the API, contact the [Logz.io support team](mailto:help@logz.io). ### Method POST ### Endpoint /v1/user-management ``` -------------------------------- ### Get Snapshot by ID Source: https://github.com/logzio/logz-api/blob/master/docs/logz/get-snapshot.api.mdx Fetches the details of a snapshot using its ID. This is a GET request to the snapshot endpoint. ```APIDOC ## GET /logzio/logz-api/v1/snapshots/{snapshotId} ### Description Retrieves details about a specific snapshot. ### Method GET ### Endpoint /logzio/logz-api/v1/snapshots/{snapshotId} ### Parameters #### Path Parameters - **snapshotId** (integer) - Required - ID of the snapshot ### Response #### Success Response (200) - **snapshotId** (integer) - ID of the snapshot - **accountId** (integer) - ID of the account - **snapshotType** (string) - The object type. Possible values: [`DASHBOARD`, `VISUALIZATION`] - **status** (string) - Status of the snapshot capture operation. Possible values: [`SUCCESS`, `FAILED`, `IN_PROGRESS`] - **snapshotSavedObjectName** (string) - Name of the object captured in the snapshot - **imageUrl** (string) - Web address where the snapshot image is stored - **appLinkUrl** (string) - A link to the snapshot in the Logz.io app - **message** (string) - Message to send to snapshot recipients - **timeFrameFrom** (integer) - Starting timedate of the visualization, as a Unix epoch integer. - **timeFrameTo** (integer) - Ending timedate of the visualization, as a Unix epoch integer. - **snapshotTimeZone** (string) - Time zone to use in `timeFrameFrom` and `timeFrameTo` ### Response Example { "snapshotId": 3094, "accountId": 5555, "snapshotType": "VISUALIZATION", "status": "SUCCESS", "snapshotSavedObjectName": "Mysql response times percentiles", "imageUrl": "https://snapshotter-logzio-prod.s3.amazonaws.com/1234/567890/snapshots/8843_3094_dC6pBjbrWc1lfN7Gob82oJuSUxTGbm8D6hDE1TcR1pVzIVO0TsB3tuZEZs1YpOGh.png", "appLinkUrl": "https://app.logz.io/#/dashboard/kibana?kibanaRoute=%2Fvisualize%2Fedit%a4d365e001-5bc9-4851-1933-a70b45a67e9d%3F_g%3D%2528time%253A%2528from%253A%25272018-06-02T15", "message": "Hey, let me know if you need me to do anything about this.", "timeFrameFrom": 389836800, "timeFrameTo": 414720000, "snapshotTimeZone": "UTC" } ``` -------------------------------- ### Logz.io Account API Response Example Source: https://github.com/logzio/logz-api/blob/master/docs/logz/get.api.mdx This JSON object represents a sample response for an account-related API call, detailing account settings and utilization. ```json { "accountId": 99999, "email": null, "accountName": "404 errors", "retentionDays": 5, "searchable": true, "accessible": false, "docSizeSetting": true, "sharingObjectsAccounts": [ { "accountId": 88888, "accountName": "dev group 8" } ], "utilizationSettings": { "frequencyMinutes": 5, "utilizationEnabled": true }, "isOwner": false, "snapsearchRetentionDays": 7, "isFlexible": true, "reservedDailyGB": 0, "maxDailyGB": 5, "isCapped": false, "totalTimeBasedDailyGB": 5, "sharedGB": 5, "softLimitGB": 0 } ``` -------------------------------- ### Create SIEM Account Source: https://github.com/logzio/logz-api/blob/master/docs/logz/post-siem.api.mdx Creates a new SIEM account. Returns SIEM account configuration settings as a JSON object. Must be run with an API token from the your main Logs account *Logs > Settings > Manage tokens > API tokens*. Please ensure to change the region in the URL to match your account's region. ```APIDOC ## POST /v2/account-management/siem ### Description Creates a new SIEM account. Returns SIEM account configuration settings as a JSON object. Must be run with an API token from the your main Logs account *Logs > Settings > Manage tokens > API tokens*. Please ensure to change the region in the URL to match your account's region. ### Method POST ### Endpoint /v2/account-management/siem ### Request Body (No request body details provided in the source) ### Response #### Success Response (200) - **(No response field details provided in the source)** #### Response Example (No response example provided in the source) ``` -------------------------------- ### Get the list of Insights Source: https://github.com/logzio/logz-api/blob/master/docs/logz/get-public-insights.api.mdx Retrieves a list of insights matching the provided search criteria. This is a GET request to the /logz/logz-api endpoint. ```APIDOC ## Get the list of Insights ### Description Get the list of Insights that match your search criteria. ### Method GET ### Endpoint /logz/logz-api ### Parameters #### Query Parameters - **query** (string) - Optional - The search query to filter insights. - **limit** (integer) - Optional - The maximum number of insights to return. - **offset** (integer) - Optional - The number of insights to skip before returning results. ### Response #### Success Response (200) - **insights** (array) - A list of insight objects. - **id** (string) - The unique identifier of the insight. - **name** (string) - The name of the insight. - **description** (string) - A description of the insight. - **createdAt** (string) - The timestamp when the insight was created. - **updatedAt** (string) - The timestamp when the insight was last updated. #### Response Example ```json { "insights": [ { "id": "insight-123", "name": "High Error Rate", "description": "An unusual spike in error logs detected.", "createdAt": "2023-10-27T10:00:00Z", "updatedAt": "2023-10-27T10:05:00Z" } ] } ``` ``` -------------------------------- ### Import necessary components for Logz.io documentation Source: https://github.com/logzio/logz-api/blob/master/docs/logz/archive-logs.tag.mdx Imports React components and Docusaurus hooks for rendering documentation cards and accessing sidebar category information. ```mdx import DocCardList from '@theme/DocCardList'; import {useCurrentSidebarCategory} from '@docusaurus/theme-common'; ``` -------------------------------- ### Generate API Documentation Source: https://github.com/logzio/logz-api/blob/master/README.md Run the Docusaurus command to generate API documentation based on the updated API specifications. This command should be executed after updating API specs and deleting relevant MDX files. ```bash yarn docusaurus gen-api-docs logz ``` -------------------------------- ### Get Public Insights Source: https://github.com/logzio/logz-api/blob/master/docs/logz/get-public-insights.api.mdx Retrieves a list of public insights. You can use this endpoint to get information about various insights, such as their titles, types, and occurrence details. ```APIDOC ## Get Public Insights ### Description Retrieves a list of public insights. This endpoint provides details about identified insights, including their type, description, and occurrence data. ### Method GET ### Endpoint `/logzio/logz/public-insights` ### Parameters #### Query Parameters - **pageSize** (integer) - Optional - The number of insights to return per page. - **from** (integer) - Optional - The starting index for pagination. ### Response #### Success Response (200) - **pageSize** (integer) - The number of insights returned in this response. - **from** (integer) - The starting index of the insights returned. - **total** (integer) - The total number of insights available. - **results** (array) - An array of insight objects. - **insightId** (string) - The unique identifier for the insight. - **insightType** (string) - The type of the insight (e.g., "PUBLIC_CI"). - **tagName** (string) - A tag associated with the insight. - **description** (string) - A detailed description of the insight. - **links** (string) - URLs providing additional context or related information. - **additionalData** (object) - Additional data associated with the insight. - **firstOccurrence** (int64) - UNIX timestamp in milliseconds specifying the earliest appearance of the Insight. The lookback period is up to 6 months. - **lastOccurrence** (int64) - UNIX timestamp in milliseconds specifying the most recent appearance of the Insight in the selected time frame. - **count** (int64) - The number of times the Insight occurred during the selected time frame. - **logTypes** (string[]) - An array of log types associated with the insight. - **kibanaLink** (string) - Only applicable for `LOGCEPTION` Insights. Provides a drill-down link to fetch the raw logs that match the Insight in Kibana Discover. - **insightTitle** (string) - The title of the Insight. #### Response Example ```json { "pageSize": 0, "from": 0, "total": 0, "results": [ { "insightId": "cf484f4c381c3e408a23accc5b487947d2f68791", "insightType": "PUBLIC_CI", "tagName": "ignite", "description": "A match for the phrase - <'Could not find the language line'> was identified in the log message. As mentioned in the cited links, this may indicate that an issue has taken place that requires your attention.", "links": "https://github.com/benedmunds/CodeIgniter-Ion-Auth/issues/784 https://www.sitepoint.com/multi-language-support-in-codeigniter/ http://forum.codeigniter.com/thread-383.html https://community.invoiceplane.com/t/topic/3322 https://www.zonwhois.com/www/gwdcanada.com.html", "additionalData": {}, "firstOccurrence": 1591181276000, "lastOccurrence": 1591253121194, "count": 66, "logTypes": [ "app-server", "user-analytics" ], "kibanaLink": "string", "insightTitle": "Could not find the language line create_user_validation_phone_label" } ] } ``` ``` -------------------------------- ### Alert Configuration Source: https://github.com/logzio/logz-api/blob/master/docs/logz/get-alert.api.mdx This section details the configuration parameters for setting up alerts in Logz.io. It covers aggregation types, fields to aggregate on, account-level querying, and trigger conditions. ```APIDOC ## Alert Configuration Details ### Aggregation Options - **aggregationType** (string) - Optional - Specifies the aggregation operator. Possible values: [`SUM`, `MIN`, `MAX`, `AVG`, `COUNT`, `UNIQUE_COUNT`, `NONE`, `PERCENTAGE`, `PERCENTILE`]. - If `COUNT`, `fieldToAggregateOn` must be null, and `groupBy` fields must not be empty. - If `NONE`, `fieldToAggregateOn` must be null, and `groupBy` field must not be empty (or null). - If `PERCENTAGE`, `valueToAggregateOn` must be specified. - If any other operator type (other than `NONE` or `COUNT`), `fieldToAggregateOn` must not be null. - **fieldToAggregateOn** (string) - Optional - Selects the field on which to run the aggregation for the trigger condition. Cannot be a field already in use for `groupBy`. - **valueToAggregateOn** (string) - Optional - Used by the `PERCENTAGE` aggregation to select the field’s value. This value is used to determine if its ratio out of the total amount of logs in the query satisfies the trigger condition. Only relevant for the `PERCENTAGE` aggregation. ### Account Querying - **shouldQueryOnAllAccounts** (boolean) - Optional - Default: `true`. Only applicable when the alert is run from the main account. If `true`, the alert runs on the main account and all associated searchable sub accounts. If `false`, specify relevant account IDs for the alert to monitor using the `accountIdsToQueryOn` field. - **accountIdsToQueryOn** (int32[]) - Optional - Specify Account IDs to select which accounts the alert should monitor. The alert will be checked only on these accounts. ### Trigger Conditions - **trigger** (object) - Sets the triggering threshold and severity tab to label the event when the alert triggers. - **operator** (string) - Optional - Specifies the operator for evaluating the results. Possible values: [`LESS_THAN`, `GREATER_THAN`, `LESS_THAN_OR_EQUALS`, `GREATER_THAN_OR_EQUALS`, `EQUALS`, `NOT_EQUALS`]. - **severityThresholdTiers** (object) - Optional - Sets a severity label per trigger threshold as a key:value pair. Possible values: [`INFO`, `LOW`, `MEDIUM`, `HIGH`, `SEVERE`]. Default: `{"MEDIUM":10}`. Example: `{"MEDIUM":10,"HIGH":100,"SEVERE":300}`. ### Output Configuration - **output** (object) - Selects the data output to be sent in the notification when the alert triggers. Not applicable when grouping by fields or aggregating results, as the output is auto-selected. ``` -------------------------------- ### Example Alert Configuration Source: https://github.com/logzio/logz-api/blob/master/docs/logz/get-all-alerts.api.mdx This JSON object represents a typical alert configuration, including details about its schedule, trigger conditions, and output settings. It can be used as a reference for understanding the structure of alert data returned by the API. ```json [ { "id": 627816, "updatedAt": "2020-04-02T18:58:16.000Z", "updatedBy": "tomer@logz.io", "createdAt": "2020-02-02T18:58:16.000Z", "createdBy": "tomer@logz.io", "enabled": true, "title": "Excessive WARN levels in PROD", "description": "Steps to remediate...", "tags": [ "network", "aws" ], "output": { "recipients": { "emails": [ "tom.a@logz.io" ], "notificationEndpointIds": [ 0 ] }, "suppressNotificationsMinutes": 60, "type": "JSON" }, "searchTimeFrameMinutes": 0, "subComponents": [ { "queryDefinition": { "query": "type:apache_access", "filters": { "bool": { "must": [ { "match_phrase": { "Field": { "query": "value" } } } ], "must_not": [ { "match_phrase": { "Field": { "query": "value" } } } ] } }, "groupBy": [ "string" ], "aggregation": { "aggregationType": "SUM", "fieldToAggregateOn": "string", "valueToAggregateOn": "string" }, "shouldQueryOnAllAccounts": false, "accountIdsToQueryOn": [ 2321 ] }, "trigger": { "operator": "GREATER_THAN_OR_EQUALS", "severityThresholdTiers": { "MEDIUM": 10, "HIGH": 100, "SEVERE": 300 } }, "output": { "columns": [ { "fieldName": "string", "regex": "string", "sort": "DESC" } ], "shouldUseAllFields": true } } ], "correlations": { "correlationOperators": [ "AND" ], "joins": [ { "0": "region", "1": "region" } ] }, "schedule": { "cronExpression": "string", "timezone": "string" }, "sendToAll": false } ] ``` -------------------------------- ### Alert Rule Request Example Source: https://github.com/logzio/logz-api/blob/master/docs/logz/get-alert-rules.api.mdx Example JSON payload for creating or updating an alert rule. It includes rule configuration, data source, query, and alert conditions. ```json { "condition": { "all": [ { "operator": { "type": "and" }, "query": { "params": [ null ] }, "reducer": { "params": [ null ], "type": "avg" }, "type": "query" } ] }, "datasource": { "type": "__expr__", "uid": "__expr__" }, "expression": "1 == 1", "hide": true, "intervalMs": 1000, "maxDataPoints": 43200, "refId": "A", "type": "math" }, "queryType": null, "refId": "A", "relativeTimeRange": { "from": 0, "to": 0 } ], "execErrState": "Alerting", "folderUID": "project_x", "for": "5m", "id": 0, "labels": { "team": "sre-team-1" }, "noDataState": "Alerting", "orgID": 0, "provenance": "string", "ruleGroup": "eval_group_1", "title": "Always firing", "uid": "string", "updated": "2022-08-16T11:07:04.763Z" } ```