query_definitions
Creates, updates, deletes or gets a query_definition
resource or lists query_definitions
in a region
Overview
Name | query_definitions |
Type | Resource |
Description | The resource schema for AWSLogs QueryDefinition |
Id | aws.logs.query_definitions |
Fields
Name | Datatype | Description |
---|---|---|
name | string | A name for the saved query definition |
query_string | string | The query string to use for this definition |
log_group_names | array | Optionally define specific log groups as part of your query definition |
query_definition_id | string | Unique identifier of a query definition |
region | string | AWS region. |
Methods
Name | Accessible by | Required Params |
---|---|---|
create_resource | INSERT | Name, QueryString, region |
delete_resource | DELETE | data__Identifier, region |
update_resource | UPDATE | data__Identifier, data__PatchDocument, region |
list_resources | SELECT | region |
get_resource | SELECT | data__Identifier, region |
SELECT
examples
Gets all query_definitions
in a region.
SELECT
region,
name,
query_string,
log_group_names,
query_definition_id
FROM aws.logs.query_definitions
WHERE region = 'us-east-1';
Gets all properties from an individual query_definition
.
SELECT
region,
name,
query_string,
log_group_names,
query_definition_id
FROM aws.logs.query_definitions
WHERE region = 'us-east-1' AND data__Identifier = '<QueryDefinitionId>';
INSERT
example
Use the following StackQL query and manifest file to create a new query_definition
resource, using stack-deploy
.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO aws.logs.query_definitions (
Name,
QueryString,
region
)
SELECT
'{{ Name }}',
'{{ QueryString }}',
'{{ region }}';
/*+ create */
INSERT INTO aws.logs.query_definitions (
Name,
QueryString,
LogGroupNames,
region
)
SELECT
'{{ Name }}',
'{{ QueryString }}',
'{{ LogGroupNames }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: query_definition
props:
- name: Name
value: '{{ Name }}'
- name: QueryString
value: '{{ QueryString }}'
- name: LogGroupNames
value:
- '{{ LogGroupNames[0] }}'
DELETE
example
/*+ delete */
DELETE FROM aws.logs.query_definitions
WHERE data__Identifier = '<QueryDefinitionId>'
AND region = 'us-east-1';
Permissions
To operate on the query_definitions
resource, the following permissions are required:
Create
logs:PutQueryDefinition
Read
logs:DescribeQueryDefinitions
Update
logs:PutQueryDefinition
Delete
logs:DeleteQueryDefinition
List
logs:DescribeQueryDefinitions