tencent cloud

masukan

Log management

Terakhir diperbarui:2024-02-02 16:24:05

    Overview

    This document provides an overview of APIs and SDK code samples related to log management.
    API
    Operation Name
    Operation Description
    Setting log management
    Enables logging for the source bucket
    Querying log management
    Queries the logging configuration information of the source bucket

    Setting Log Management

    Feature description

    This API (PUT Bucket logging) is used to enable logging for the source bucket and store its access logs in a specified destination bucket.

    Method prototype

    public void setBucketLoggingConfiguration(SetBucketLoggingConfigurationRequest setBucketLoggingConfigurationRequest);

    Sample request

    String bucketName = "examplebucket-1250000000";
    BucketLoggingConfiguration bucketLoggingConfiguration = new BucketLoggingConfiguration();
    bucketLoggingConfiguration.setDestinationBucketName(bucketName);
    bucketLoggingConfiguration.setLogFilePrefix("logs");
    SetBucketLoggingConfigurationRequest setBucketLoggingConfigurationRequest = new SetBucketLoggingConfigurationRequest(bucketName, bucketLoggingConfiguration);
    cosclient.setBucketLoggingConfiguration(setBucketLoggingConfigurationRequest);

    Parameter description

    Parameter Name
    Description
    Type
    setBucketLoggingConfigurationRequest
    Request to enable logging feature
    SetBucketLoggingConfigurationRequest
    Request member description:
    Request Member
    Setting Method
    Description
    Type
    bucketName
    Constructor or set method
    Source bucket for which to enable the logging feature in the format of BucketName-APPID. For more information, please see Naming Convention
    String
    loggingConfiguration
    Constructor or set method
    Bucket logging feature configuration
    BucketLoggingConfiguration
    BucketLoggingConfiguration member description:
    Parameter Name
    Description
    Type
    destinationBucketName
    Destination bucket where to store logs in the format of BucketName-APPID. For more information, please see Naming Convention
    String
    logFilePrefix
    Specified path in the destination bucket for storing logs
    String

    Returned result description

    Success: no returned value.
    Failure: an error (e.g., authentication failed) occurred and a CosClientException or CosServiceException exception was thrown. For more information, please see Troubleshooting.

    Querying Log Management

    Feature description

    This API (GET Bucket logging) is used to query the log configuration information of a specified bucket.

    Method prototype

    public BucketLoggingConfiguration getBucketLoggingConfiguration(String bucketName);

    Sample request

    String bucketName = "examplebucket-1250000000";
    BucketLoggingConfiguration bucketLoggingConfiguration = cosclient.getBucketLoggingConfiguration(bucketName);

    Parameter description

    Parameter Name
    Description
    Type
    bucketName
    Destination bucket where to store logs in the format of BucketName-APPID. For more information, please see Naming Convention
    String

    Returned result description

    Success: BucketLoggingConfiguration is returned, which contains the name of the destination bucket and specified path in the destination bucket for storing logs
    Failure: an error (e.g., authentication failed) occurred and a CosClientException or CosServiceException exception was thrown. For more information, please see Troubleshooting.
    Hubungi Kami

    Hubungi tim penjualan atau penasihat bisnis kami untuk membantu bisnis Anda.

    Dukungan Teknis

    Buka tiket jika Anda mencari bantuan lebih lanjut. Tiket kami tersedia 7x24.

    Dukungan Telepon 7x24