The logging command is used to add, modify, query, or delete the logging configurations for a specified bucket.
- The commands described in this topic apply to Linux. To use the commands in other systems, replace ./ossutil in the command with the actual executable program name. For example, you can use the help command in 32-bit Windows systems by running ossutil32.exe help.
- For more information about logging, see Logging.
Command syntax
- Add or modify logging configurations
./ossutil logging --method put oss://bucket oss://target-bucket/[prefix]
If logging is disabled for the bucket, you can run this command to save access logs as objects in the bucket specified by the target-bucket parameter. However, if logging is enabled for the bucket, you can run this command to change the directory in which access logs are stored.
The prefix parameter specifies the prefix of access logs and the directory where bucket access logs are stored. If this parameter is specified, ossutil saves access logs to the directory of the bucket specified by the target-bucket parameter. If this parameter is not specified, ossutil saves your access logs to the root directory of the bucket specified by the target-bucket parameter. For more information about log file naming conventions, see Set logging.
- Query logging configurations
./ossutil logging --method get oss://bucket [local_xml_file]
The local_xml_file parameter specifies the name of the configuration file. If this parameter is specified, ossutil saves the obtained logging configurations as a local file. If this parameter is not specified, ossutil displays the obtained logging configurations.
- Delete logging configurations
./ossutil logging --method delete oss://bucket
Examples
- Add logging configurations
./ossutil logging --method put oss://bucket1 oss://bucket2/logging
- Query logging configurations
./ossutil logging --method get oss://bucket1 /file/logging.xml
- Delete logging configurations
./ossutil logging --method delete oss://bucket1
Common options
Option | Description |
---|---|
--method | Specifies the HTTP request method. Valid values:
|
--loglevel | Specifies the log level. The default value is null, indicating that no log files are
generated. Valid values:
|
--proxy-host | Specifies the URL of the proxy server. HTTP, HTTPS, and SOCKS5 proxies are supported. An example of the URL is http://120.79. **.**:3128 or socks5://120.79. **. **:1080. |
--proxy-user | Specifies the username for the proxy server. The default value is null. |
--proxy-pwd | Specifies the password for the proxy server. The default value is null. |