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

tencentcloud.getCynosdbAuditLogs

Explore with Pulumi AI

tencentcloud logo
tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack

    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",
    });
    
    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")
    
    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
    	})
    }
    
    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",
        });
    
    });
    
    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());
    
        }
    }
    
    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
    

    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>
    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]
    func GetCynosdbAuditLogs(ctx *Context, args *GetCynosdbAuditLogsArgs, opts ...InvokeOption) (*GetCynosdbAuditLogsResult, error)
    func GetCynosdbAuditLogsOutput(ctx *Context, args *GetCynosdbAuditLogsOutputArgs, opts ...InvokeOption) GetCynosdbAuditLogsResultOutput

    > 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)
    }
    public static CompletableFuture<GetCynosdbAuditLogsResult> getCynosdbAuditLogs(GetCynosdbAuditLogsArgs args, InvokeOptions options)
    public static Output<GetCynosdbAuditLogsResult> getCynosdbAuditLogs(GetCynosdbAuditLogsArgs args, InvokeOptions options)
    
    fn::invoke:
      function: tencentcloud:index/getCynosdbAuditLogs:getCynosdbAuditLogs
      arguments:
        # arguments dictionary

    The following arguments are supported:

    EndTime string
    The end time is in the format of 2017-07-12 10:29:20.
    InstanceId string
    Instance ID.
    StartTime 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 string
    The end time is in the format of 2017-07-12 10:29:20.
    InstanceId string
    Instance ID.
    StartTime 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 String
    The end time is in the format of 2017-07-12 10:29:20.
    instanceId String
    Instance ID.
    startTime 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 string
    The end time is in the format of 2017-07-12 10:29:20.
    instanceId string
    Instance ID.
    startTime 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 str
    The end time is in the format of 2017-07-12 10:29:20.
    instance_id str
    Instance ID.
    start_time 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 String
    The end time is in the format of 2017-07-12 10:29:20.
    instanceId String
    Instance ID.
    startTime 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 double
    Affects the number of rows.
    DbName string
    Database name.
    ErrCode double
    Error code.
    ExecTime double
    Execution time.
    Host string
    Client address.
    InstanceName string
    Instance name.
    PolicyName string
    Audit policy name.
    SentRows double
    Number of rows sent.
    Sql string
    SQL statement.
    SqlType string
    SQL type.
    TableName string
    Table name.
    ThreadId double
    Execution thread ID.
    Timestamp string
    Timestamp.
    User string
    User name.
    AffectRows float64
    Affects the number of rows.
    DbName string
    Database name.
    ErrCode float64
    Error code.
    ExecTime float64
    Execution time.
    Host string
    Client address.
    InstanceName string
    Instance name.
    PolicyName string
    Audit policy name.
    SentRows float64
    Number of rows sent.
    Sql string
    SQL statement.
    SqlType string
    SQL type.
    TableName string
    Table name.
    ThreadId float64
    Execution thread ID.
    Timestamp string
    Timestamp.
    User string
    User name.
    affectRows Double
    Affects the number of rows.
    dbName String
    Database name.
    errCode Double
    Error code.
    execTime Double
    Execution time.
    host String
    Client address.
    instanceName String
    Instance name.
    policyName String
    Audit policy name.
    sentRows Double
    Number of rows sent.
    sql String
    SQL statement.
    sqlType String
    SQL type.
    tableName String
    Table name.
    threadId Double
    Execution thread ID.
    timestamp String
    Timestamp.
    user String
    User name.
    affectRows number
    Affects the number of rows.
    dbName string
    Database name.
    errCode number
    Error code.
    execTime number
    Execution time.
    host string
    Client address.
    instanceName string
    Instance name.
    policyName string
    Audit policy name.
    sentRows number
    Number of rows sent.
    sql string
    SQL statement.
    sqlType string
    SQL type.
    tableName string
    Table name.
    threadId number
    Execution thread ID.
    timestamp string
    Timestamp.
    user string
    User name.
    affect_rows float
    Affects the number of rows.
    db_name str
    Database name.
    err_code float
    Error code.
    exec_time float
    Execution time.
    host str
    Client address.
    instance_name str
    Instance name.
    policy_name str
    Audit policy name.
    sent_rows float
    Number of rows sent.
    sql str
    SQL statement.
    sql_type str
    SQL type.
    table_name str
    Table name.
    thread_id float
    Execution thread ID.
    timestamp str
    Timestamp.
    user str
    User name.
    affectRows Number
    Affects the number of rows.
    dbName String
    Database name.
    errCode Number
    Error code.
    execTime Number
    Execution time.
    host String
    Client address.
    instanceName String
    Instance name.
    policyName String
    Audit policy name.
    sentRows Number
    Number of rows sent.
    sql String
    SQL statement.
    sqlType String
    SQL type.
    tableName String
    Table name.
    threadId Number
    Execution thread ID.
    timestamp String
    Timestamp.
    user String
    User name.

    Package Details

    Repository
    tencentcloud tencentcloudstack/terraform-provider-tencentcloud
    License
    Notes
    This Pulumi package is based on the tencentcloud Terraform Provider.
    tencentcloud logo
    tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack