1. Packages
  2. Tencentcloud Provider
  3. API Docs
  4. getCynosdbAuditLogs
tencentcloud 1.81.183 published on Wednesday, Apr 16, 2025 by tencentcloudstack

tencentcloud.getCynosdbAuditLogs

Explore with Pulumi AI

Use this data source to query detailed information of cynosdb audit_logs

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as tencentcloud from "@pulumi/tencentcloud";

const auditLogs = tencentcloud.getCynosdbAuditLogs({
    endTime: "2023-06-18 10:00:02",
    filter: {
        hosts: ["30.50.207.176"],
        policyNames: ["default_audit"],
        sql: "SELECT @@max_allowed_packet",
        sqlType: "SELECT",
        users: ["keep_dts"],
    },
    instanceId: "cynosdbmysql-ins-afqx1hy0",
    order: "DESC",
    orderBy: "timestamp",
    startTime: "2023-06-18 10:00:00",
});
Copy
import pulumi
import pulumi_tencentcloud as tencentcloud

audit_logs = tencentcloud.get_cynosdb_audit_logs(end_time="2023-06-18 10:00:02",
    filter={
        "hosts": ["30.50.207.176"],
        "policy_names": ["default_audit"],
        "sql": "SELECT @@max_allowed_packet",
        "sql_type": "SELECT",
        "users": ["keep_dts"],
    },
    instance_id="cynosdbmysql-ins-afqx1hy0",
    order="DESC",
    order_by="timestamp",
    start_time="2023-06-18 10:00:00")
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := tencentcloud.GetCynosdbAuditLogs(ctx, &tencentcloud.GetCynosdbAuditLogsArgs{
			EndTime: "2023-06-18 10:00:02",
			Filter: tencentcloud.GetCynosdbAuditLogsFilter{
				Hosts: []string{
					"30.50.207.176",
				},
				PolicyNames: []string{
					"default_audit",
				},
				Sql:     pulumi.StringRef("SELECT @@max_allowed_packet"),
				SqlType: pulumi.StringRef("SELECT"),
				Users: []string{
					"keep_dts",
				},
			},
			InstanceId: "cynosdbmysql-ins-afqx1hy0",
			Order:      pulumi.StringRef("DESC"),
			OrderBy:    pulumi.StringRef("timestamp"),
			StartTime:  "2023-06-18 10:00:00",
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Tencentcloud = Pulumi.Tencentcloud;

return await Deployment.RunAsync(() => 
{
    var auditLogs = Tencentcloud.GetCynosdbAuditLogs.Invoke(new()
    {
        EndTime = "2023-06-18 10:00:02",
        Filter = new Tencentcloud.Inputs.GetCynosdbAuditLogsFilterInputArgs
        {
            Hosts = new[]
            {
                "30.50.207.176",
            },
            PolicyNames = new[]
            {
                "default_audit",
            },
            Sql = "SELECT @@max_allowed_packet",
            SqlType = "SELECT",
            Users = new[]
            {
                "keep_dts",
            },
        },
        InstanceId = "cynosdbmysql-ins-afqx1hy0",
        Order = "DESC",
        OrderBy = "timestamp",
        StartTime = "2023-06-18 10:00:00",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.tencentcloud.TencentcloudFunctions;
import com.pulumi.tencentcloud.inputs.GetCynosdbAuditLogsArgs;
import com.pulumi.tencentcloud.inputs.GetCynosdbAuditLogsFilterArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var auditLogs = TencentcloudFunctions.getCynosdbAuditLogs(GetCynosdbAuditLogsArgs.builder()
            .endTime("2023-06-18 10:00:02")
            .filter(GetCynosdbAuditLogsFilterArgs.builder()
                .hosts("30.50.207.176")
                .policyNames("default_audit")
                .sql("SELECT @@max_allowed_packet")
                .sqlType("SELECT")
                .users("keep_dts")
                .build())
            .instanceId("cynosdbmysql-ins-afqx1hy0")
            .order("DESC")
            .orderBy("timestamp")
            .startTime("2023-06-18 10:00:00")
            .build());

    }
}
Copy
variables:
  auditLogs:
    fn::invoke:
      function: tencentcloud:getCynosdbAuditLogs
      arguments:
        endTime: 2023-06-18 10:00:02
        filter:
          hosts:
            - 30.50.207.176
          policyNames:
            - default_audit
          sql: SELECT @@max_allowed_packet
          sqlType: SELECT
          users:
            - keep_dts
        instanceId: cynosdbmysql-ins-afqx1hy0
        order: DESC
        orderBy: timestamp
        startTime: 2023-06-18 10:00:00
Copy

Using getCynosdbAuditLogs

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getCynosdbAuditLogs(args: GetCynosdbAuditLogsArgs, opts?: InvokeOptions): Promise<GetCynosdbAuditLogsResult>
function getCynosdbAuditLogsOutput(args: GetCynosdbAuditLogsOutputArgs, opts?: InvokeOptions): Output<GetCynosdbAuditLogsResult>
Copy
def get_cynosdb_audit_logs(end_time: Optional[str] = None,
                           filter: Optional[GetCynosdbAuditLogsFilter] = None,
                           id: Optional[str] = None,
                           instance_id: Optional[str] = None,
                           order: Optional[str] = None,
                           order_by: Optional[str] = None,
                           result_output_file: Optional[str] = None,
                           start_time: Optional[str] = None,
                           opts: Optional[InvokeOptions] = None) -> GetCynosdbAuditLogsResult
def get_cynosdb_audit_logs_output(end_time: Optional[pulumi.Input[str]] = None,
                           filter: Optional[pulumi.Input[GetCynosdbAuditLogsFilterArgs]] = None,
                           id: Optional[pulumi.Input[str]] = None,
                           instance_id: Optional[pulumi.Input[str]] = None,
                           order: Optional[pulumi.Input[str]] = None,
                           order_by: Optional[pulumi.Input[str]] = None,
                           result_output_file: Optional[pulumi.Input[str]] = None,
                           start_time: Optional[pulumi.Input[str]] = None,
                           opts: Optional[InvokeOptions] = None) -> Output[GetCynosdbAuditLogsResult]
Copy
func GetCynosdbAuditLogs(ctx *Context, args *GetCynosdbAuditLogsArgs, opts ...InvokeOption) (*GetCynosdbAuditLogsResult, error)
func GetCynosdbAuditLogsOutput(ctx *Context, args *GetCynosdbAuditLogsOutputArgs, opts ...InvokeOption) GetCynosdbAuditLogsResultOutput
Copy

> Note: This function is named GetCynosdbAuditLogs in the Go SDK.

public static class GetCynosdbAuditLogs 
{
    public static Task<GetCynosdbAuditLogsResult> InvokeAsync(GetCynosdbAuditLogsArgs args, InvokeOptions? opts = null)
    public static Output<GetCynosdbAuditLogsResult> Invoke(GetCynosdbAuditLogsInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetCynosdbAuditLogsResult> getCynosdbAuditLogs(GetCynosdbAuditLogsArgs args, InvokeOptions options)
public static Output<GetCynosdbAuditLogsResult> getCynosdbAuditLogs(GetCynosdbAuditLogsArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: tencentcloud:index/getCynosdbAuditLogs:getCynosdbAuditLogs
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

EndTime This property is required. string
The end time is in the format of 2017-07-12 10:29:20.
InstanceId This property is required. string
Instance ID.
StartTime This property is required. string
Start time, format: 2017-07-12 10:29:20.
Filter GetCynosdbAuditLogsFilter
Filter conditions. You can filter logs according to the set filtering criteria.
Id string
Order string
Sort by. The supported values include: ASC - ascending order, DESC - descending order.
OrderBy string
Sort fields. The supported values include: timestamp - timestamp; &#39;effectRows&#39; - affects the number of rows; &#39;execTime&#39; - Execution time.
ResultOutputFile string
Used to save results.
EndTime This property is required. string
The end time is in the format of 2017-07-12 10:29:20.
InstanceId This property is required. string
Instance ID.
StartTime This property is required. string
Start time, format: 2017-07-12 10:29:20.
Filter GetCynosdbAuditLogsFilter
Filter conditions. You can filter logs according to the set filtering criteria.
Id string
Order string
Sort by. The supported values include: ASC - ascending order, DESC - descending order.
OrderBy string
Sort fields. The supported values include: timestamp - timestamp; &#39;effectRows&#39; - affects the number of rows; &#39;execTime&#39; - Execution time.
ResultOutputFile string
Used to save results.
endTime This property is required. String
The end time is in the format of 2017-07-12 10:29:20.
instanceId This property is required. String
Instance ID.
startTime This property is required. String
Start time, format: 2017-07-12 10:29:20.
filter GetCynosdbAuditLogsFilter
Filter conditions. You can filter logs according to the set filtering criteria.
id String
order String
Sort by. The supported values include: ASC - ascending order, DESC - descending order.
orderBy String
Sort fields. The supported values include: timestamp - timestamp; &#39;effectRows&#39; - affects the number of rows; &#39;execTime&#39; - Execution time.
resultOutputFile String
Used to save results.
endTime This property is required. string
The end time is in the format of 2017-07-12 10:29:20.
instanceId This property is required. string
Instance ID.
startTime This property is required. string
Start time, format: 2017-07-12 10:29:20.
filter GetCynosdbAuditLogsFilter
Filter conditions. You can filter logs according to the set filtering criteria.
id string
order string
Sort by. The supported values include: ASC - ascending order, DESC - descending order.
orderBy string
Sort fields. The supported values include: timestamp - timestamp; &#39;effectRows&#39; - affects the number of rows; &#39;execTime&#39; - Execution time.
resultOutputFile string
Used to save results.
end_time This property is required. str
The end time is in the format of 2017-07-12 10:29:20.
instance_id This property is required. str
Instance ID.
start_time This property is required. str
Start time, format: 2017-07-12 10:29:20.
filter GetCynosdbAuditLogsFilter
Filter conditions. You can filter logs according to the set filtering criteria.
id str
order str
Sort by. The supported values include: ASC - ascending order, DESC - descending order.
order_by str
Sort fields. The supported values include: timestamp - timestamp; &#39;effectRows&#39; - affects the number of rows; &#39;execTime&#39; - Execution time.
result_output_file str
Used to save results.
endTime This property is required. String
The end time is in the format of 2017-07-12 10:29:20.
instanceId This property is required. String
Instance ID.
startTime This property is required. String
Start time, format: 2017-07-12 10:29:20.
filter Property Map
Filter conditions. You can filter logs according to the set filtering criteria.
id String
order String
Sort by. The supported values include: ASC - ascending order, DESC - descending order.
orderBy String
Sort fields. The supported values include: timestamp - timestamp; &#39;effectRows&#39; - affects the number of rows; &#39;execTime&#39; - Execution time.
resultOutputFile String
Used to save results.

getCynosdbAuditLogs Result

The following output properties are available:

EndTime string
Id string
InstanceId string
Items List<GetCynosdbAuditLogsItem>
Audit log details. Note: This field may return null, indicating that a valid value cannot be obtained.
StartTime string
Filter GetCynosdbAuditLogsFilter
Order string
OrderBy string
ResultOutputFile string
EndTime string
Id string
InstanceId string
Items []GetCynosdbAuditLogsItem
Audit log details. Note: This field may return null, indicating that a valid value cannot be obtained.
StartTime string
Filter GetCynosdbAuditLogsFilter
Order string
OrderBy string
ResultOutputFile string
endTime String
id String
instanceId String
items List<GetCynosdbAuditLogsItem>
Audit log details. Note: This field may return null, indicating that a valid value cannot be obtained.
startTime String
filter GetCynosdbAuditLogsFilter
order String
orderBy String
resultOutputFile String
endTime string
id string
instanceId string
items GetCynosdbAuditLogsItem[]
Audit log details. Note: This field may return null, indicating that a valid value cannot be obtained.
startTime string
filter GetCynosdbAuditLogsFilter
order string
orderBy string
resultOutputFile string
end_time str
id str
instance_id str
items Sequence[GetCynosdbAuditLogsItem]
Audit log details. Note: This field may return null, indicating that a valid value cannot be obtained.
start_time str
filter GetCynosdbAuditLogsFilter
order str
order_by str
result_output_file str
endTime String
id String
instanceId String
items List<Property Map>
Audit log details. Note: This field may return null, indicating that a valid value cannot be obtained.
startTime String
filter Property Map
order String
orderBy String
resultOutputFile String

Supporting Types

GetCynosdbAuditLogsFilter

AffectRows double
Affects the number of rows. Indicates that filtering affects audit logs with rows greater than this value.
DbNames List<string>
Database name.
ExecTime double
Execution time. Unit: ms. Indicates audit logs with a filter execution time greater than this value.
Hosts List<string>
Client address.
PolicyNames List<string>
Audit policy name.
SentRows double
Returns the number of rows.
Sql string
SQL statement. Supports fuzzy matching.
SqlType string
SQL type. Currently supported: SELECT, Insert, UPDATE, DELETE, CREATE, DROP, ALT, SET, REPLACE, EXECUTE.
SqlTypes List<string>
SQL type. Supports simultaneous querying of multiple types. Currently supported: SELECT, Insert, UPDATE, DELETE, CREATE, DROP, ALT, SET, REPLACE, EXECUTE.
Sqls List<string>
SQL statement. Supports passing multiple SQL statements.
TableNames List<string>
Table name.
ThreadIds List<string>
Thread ID.
Users List<string>
User name.
AffectRows float64
Affects the number of rows. Indicates that filtering affects audit logs with rows greater than this value.
DbNames []string
Database name.
ExecTime float64
Execution time. Unit: ms. Indicates audit logs with a filter execution time greater than this value.
Hosts []string
Client address.
PolicyNames []string
Audit policy name.
SentRows float64
Returns the number of rows.
Sql string
SQL statement. Supports fuzzy matching.
SqlType string
SQL type. Currently supported: SELECT, Insert, UPDATE, DELETE, CREATE, DROP, ALT, SET, REPLACE, EXECUTE.
SqlTypes []string
SQL type. Supports simultaneous querying of multiple types. Currently supported: SELECT, Insert, UPDATE, DELETE, CREATE, DROP, ALT, SET, REPLACE, EXECUTE.
Sqls []string
SQL statement. Supports passing multiple SQL statements.
TableNames []string
Table name.
ThreadIds []string
Thread ID.
Users []string
User name.
affectRows Double
Affects the number of rows. Indicates that filtering affects audit logs with rows greater than this value.
dbNames List<String>
Database name.
execTime Double
Execution time. Unit: ms. Indicates audit logs with a filter execution time greater than this value.
hosts List<String>
Client address.
policyNames List<String>
Audit policy name.
sentRows Double
Returns the number of rows.
sql String
SQL statement. Supports fuzzy matching.
sqlType String
SQL type. Currently supported: SELECT, Insert, UPDATE, DELETE, CREATE, DROP, ALT, SET, REPLACE, EXECUTE.
sqlTypes List<String>
SQL type. Supports simultaneous querying of multiple types. Currently supported: SELECT, Insert, UPDATE, DELETE, CREATE, DROP, ALT, SET, REPLACE, EXECUTE.
sqls List<String>
SQL statement. Supports passing multiple SQL statements.
tableNames List<String>
Table name.
threadIds List<String>
Thread ID.
users List<String>
User name.
affectRows number
Affects the number of rows. Indicates that filtering affects audit logs with rows greater than this value.
dbNames string[]
Database name.
execTime number
Execution time. Unit: ms. Indicates audit logs with a filter execution time greater than this value.
hosts string[]
Client address.
policyNames string[]
Audit policy name.
sentRows number
Returns the number of rows.
sql string
SQL statement. Supports fuzzy matching.
sqlType string
SQL type. Currently supported: SELECT, Insert, UPDATE, DELETE, CREATE, DROP, ALT, SET, REPLACE, EXECUTE.
sqlTypes string[]
SQL type. Supports simultaneous querying of multiple types. Currently supported: SELECT, Insert, UPDATE, DELETE, CREATE, DROP, ALT, SET, REPLACE, EXECUTE.
sqls string[]
SQL statement. Supports passing multiple SQL statements.
tableNames string[]
Table name.
threadIds string[]
Thread ID.
users string[]
User name.
affect_rows float
Affects the number of rows. Indicates that filtering affects audit logs with rows greater than this value.
db_names Sequence[str]
Database name.
exec_time float
Execution time. Unit: ms. Indicates audit logs with a filter execution time greater than this value.
hosts Sequence[str]
Client address.
policy_names Sequence[str]
Audit policy name.
sent_rows float
Returns the number of rows.
sql str
SQL statement. Supports fuzzy matching.
sql_type str
SQL type. Currently supported: SELECT, Insert, UPDATE, DELETE, CREATE, DROP, ALT, SET, REPLACE, EXECUTE.
sql_types Sequence[str]
SQL type. Supports simultaneous querying of multiple types. Currently supported: SELECT, Insert, UPDATE, DELETE, CREATE, DROP, ALT, SET, REPLACE, EXECUTE.
sqls Sequence[str]
SQL statement. Supports passing multiple SQL statements.
table_names Sequence[str]
Table name.
thread_ids Sequence[str]
Thread ID.
users Sequence[str]
User name.
affectRows Number
Affects the number of rows. Indicates that filtering affects audit logs with rows greater than this value.
dbNames List<String>
Database name.
execTime Number
Execution time. Unit: ms. Indicates audit logs with a filter execution time greater than this value.
hosts List<String>
Client address.
policyNames List<String>
Audit policy name.
sentRows Number
Returns the number of rows.
sql String
SQL statement. Supports fuzzy matching.
sqlType String
SQL type. Currently supported: SELECT, Insert, UPDATE, DELETE, CREATE, DROP, ALT, SET, REPLACE, EXECUTE.
sqlTypes List<String>
SQL type. Supports simultaneous querying of multiple types. Currently supported: SELECT, Insert, UPDATE, DELETE, CREATE, DROP, ALT, SET, REPLACE, EXECUTE.
sqls List<String>
SQL statement. Supports passing multiple SQL statements.
tableNames List<String>
Table name.
threadIds List<String>
Thread ID.
users List<String>
User name.

GetCynosdbAuditLogsItem

AffectRows This property is required. double
Affects the number of rows.
DbName This property is required. string
Database name.
ErrCode This property is required. double
Error code.
ExecTime This property is required. double
Execution time.
Host This property is required. string
Client address.
InstanceName This property is required. string
Instance name.
PolicyName This property is required. string
Audit policy name.
SentRows This property is required. double
Number of rows sent.
Sql This property is required. string
SQL statement.
SqlType This property is required. string
SQL type.
TableName This property is required. string
Table name.
ThreadId This property is required. double
Execution thread ID.
Timestamp This property is required. string
Timestamp.
User This property is required. string
User name.
AffectRows This property is required. float64
Affects the number of rows.
DbName This property is required. string
Database name.
ErrCode This property is required. float64
Error code.
ExecTime This property is required. float64
Execution time.
Host This property is required. string
Client address.
InstanceName This property is required. string
Instance name.
PolicyName This property is required. string
Audit policy name.
SentRows This property is required. float64
Number of rows sent.
Sql This property is required. string
SQL statement.
SqlType This property is required. string
SQL type.
TableName This property is required. string
Table name.
ThreadId This property is required. float64
Execution thread ID.
Timestamp This property is required. string
Timestamp.
User This property is required. string
User name.
affectRows This property is required. Double
Affects the number of rows.
dbName This property is required. String
Database name.
errCode This property is required. Double
Error code.
execTime This property is required. Double
Execution time.
host This property is required. String
Client address.
instanceName This property is required. String
Instance name.
policyName This property is required. String
Audit policy name.
sentRows This property is required. Double
Number of rows sent.
sql This property is required. String
SQL statement.
sqlType This property is required. String
SQL type.
tableName This property is required. String
Table name.
threadId This property is required. Double
Execution thread ID.
timestamp This property is required. String
Timestamp.
user This property is required. String
User name.
affectRows This property is required. number
Affects the number of rows.
dbName This property is required. string
Database name.
errCode This property is required. number
Error code.
execTime This property is required. number
Execution time.
host This property is required. string
Client address.
instanceName This property is required. string
Instance name.
policyName This property is required. string
Audit policy name.
sentRows This property is required. number
Number of rows sent.
sql This property is required. string
SQL statement.
sqlType This property is required. string
SQL type.
tableName This property is required. string
Table name.
threadId This property is required. number
Execution thread ID.
timestamp This property is required. string
Timestamp.
user This property is required. string
User name.
affect_rows This property is required. float
Affects the number of rows.
db_name This property is required. str
Database name.
err_code This property is required. float
Error code.
exec_time This property is required. float
Execution time.
host This property is required. str
Client address.
instance_name This property is required. str
Instance name.
policy_name This property is required. str
Audit policy name.
sent_rows This property is required. float
Number of rows sent.
sql This property is required. str
SQL statement.
sql_type This property is required. str
SQL type.
table_name This property is required. str
Table name.
thread_id This property is required. float
Execution thread ID.
timestamp This property is required. str
Timestamp.
user This property is required. str
User name.
affectRows This property is required. Number
Affects the number of rows.
dbName This property is required. String
Database name.
errCode This property is required. Number
Error code.
execTime This property is required. Number
Execution time.
host This property is required. String
Client address.
instanceName This property is required. String
Instance name.
policyName This property is required. String
Audit policy name.
sentRows This property is required. Number
Number of rows sent.
sql This property is required. String
SQL statement.
sqlType This property is required. String
SQL type.
tableName This property is required. String
Table name.
threadId This property is required. Number
Execution thread ID.
timestamp This property is required. String
Timestamp.
user This property is required. String
User name.

Package Details

Repository
tencentcloud tencentcloudstack/terraform-provider-tencentcloud
License
Notes
This Pulumi package is based on the tencentcloud Terraform Provider.