Aliyun.Oss.Bucket.Logging (aliyun_oss v3.3.0)
Bucket Inventory - Logging.
Summary
Functions
DeleteBucketLogging - deletes the logging configurations for a bucket.
DeleteUserDefinedLogFieldsConfig
GetBucketLogging - gets the access logging configuration of a bucket.
GetUserDefinedLogFieldsConfig
PutBucketLogging - enables logging for a bucket.
PutUserDefinedLogFieldsConfig
Functions
@spec delete(Aliyun.Oss.Config.t(), String.t()) :: {:error, Exception.t()} | {:ok, Aliyun.Oss.Client.Response.t()}
DeleteBucketLogging - deletes the logging configurations for a bucket.
Examples
iex> Aliyun.Oss.Bucket.Logging.delete(config, "some-bucket")
{:ok,
%Aliyun.Oss.Client.Response{
data: "",
headers: %{
"connection" => ["keep-alive"],
"content-length" => ["0"],
"date" => ["Wed, 09 Jul 2025 02:09:12 GMT"],
"server" => ["AliyunOSS"],
"x-oss-request-id" => ["686DCF4768CD************"],
"x-oss-server-time" => ["408"]
}
}}
iex> Aliyun.Oss.Bucket.Logging.delete(config, "unknown-bucket")
{:error,
%Aliyun.Oss.Client.Error{
status: 404,
code: "NoSuchBucket",
message: "The specified bucket does not exist.",
parsed_details: %{
"BucketName" => "unknown-bucket",
"Code" => "NoSuchBucket",
"EC" => "0015-00000101",
"HostId" => "unknown-bucket.oss-cn-shenzhen.aliyuncs.com",
"Message" => "The specified bucket does not exist.",
"RecommendDoc" => "https://api.aliyun.com/troubleshoot?q=0015-00000101",
"RequestId" => "5C38283EC84D1C4471F2F48A"
}
}}
@spec delete_user_defined_log_fields_config(Aliyun.Oss.Config.t(), String.t()) :: {:error, Exception.t()} | {:ok, Aliyun.Oss.Client.Response.t()}
DeleteUserDefinedLogFieldsConfig
Examples
iex> Aliyun.Oss.Bucket.Logging.delete_user_defined_log_fields_config(config, "some-bucket")
{:ok,
%Aliyun.Oss.Client.Response{
data: "",
headers: %{
"connection" => ["keep-alive"],
"content-length" => ["0"],
"date" => ["Wed, 09 Jul 2025 02:09:12 GMT"],
"server" => ["AliyunOSS"],
"x-oss-request-id" => ["686DCF4768CD************"],
"x-oss-server-time" => ["408"]
}
}}
@spec get(Aliyun.Oss.Config.t(), String.t()) :: {:error, Exception.t()} | {:ok, Aliyun.Oss.Client.Response.t()}
GetBucketLogging - gets the access logging configuration of a bucket.
Examples
iex> Aliyun.Oss.Bucket.Logging.get(config, "some-bucket")
{:ok, %Aliyun.Oss.Client.Response{
data: %{
"BucketLoggingStatus" => %{
"LoggingEnabled" => %{
"TargetBucket" => "some-bucket",
"TargetPrefix" => "oss-accesslog/"
}
}
},
headers: %{
"connection" => ["keep-alive"],
...
}
}}
@spec get_user_defined_log_fields_config(Aliyun.Oss.Config.t(), String.t()) :: {:error, Exception.t()} | {:ok, Aliyun.Oss.Client.Response.t()}
GetUserDefinedLogFieldsConfig
Examples
iex> Aliyun.Oss.Bucket.Logging.get_user_defined_log_fields_config(config, "some-bucket")
{:ok, %Aliyun.Oss.Client.Response{
data: %{
"UserDefinedLogFieldsConfiguration" => %{
"HeaderSet" => %{"header" => ["header1", "header2"]},
"ParamSet" => %{"parameter" => ["param1", "param2"]}
}
},
headers: %{
"connection" => ["keep-alive"],
...
}
}}
@spec put(Aliyun.Oss.Config.t(), String.t(), String.t(), String.t()) :: {:error, Exception.t()} | {:ok, Aliyun.Oss.Client.Response.t()}
PutBucketLogging - enables logging for a bucket.
Examples
iex> Aliyun.Oss.Bucket.Logging.put(config, "some-bucket", "target-bucket", "target-prefix")
{:ok,
%Aliyun.Oss.Client.Response{
data: "",
headers: %{
"connection" => ["keep-alive"],
"content-length" => ["0"],
"date" => ["Wed, 09 Jul 2025 02:04:19 GMT"],
"server" => ["AliyunOSS"],
"x-oss-request-id" => ["686DCE23993*************"],
"x-oss-server-time" => ["175"]
}
}}
@spec put_user_defined_log_fields_config( Aliyun.Oss.Config.t(), String.t(), list(), list() ) :: {:error, Exception.t()} | {:ok, Aliyun.Oss.Client.Response.t()}
PutUserDefinedLogFieldsConfig
Examples
iex> Aliyun.Oss.Bucket.Logging.put_user_defined_log_fields_config(config, "some-bucket", "target-bucket", ["header1", "header2"], ["param1", "param2"])
{:ok,
%Aliyun.Oss.Client.Response{
data: "",
headers: %{
"connection" => ["keep-alive"],
"content-length" => ["0"],
"date" => ["Wed, 09 Jul 2025 02:20:55 GMT"],
"server" => ["AliyunOSS"],
"x-oss-request-id" => ["686DD2072A7*************"],
"x-oss-server-time" => ["54"]
}
}}