All Products
Search
Document Center

Simple Log Service:pull_log_dump

Last Updated:Oct 26, 2023

Downloads a large amount of log data to local files at the same time.

Request syntax

aliyunlog log pull_log_dump --project_name=<value> --logstore_name=<value> --from_time=<value> --to_time=<value> --file_path=<value> [--batch_size=<value>] [--compress=<value>] [--encodings=<value>] [--shard_list=<value>] [--no_escape=<value>] [--access-id=<value>] [--access-key=<value>] [--sts-token=<value>] [--region-endpoint=<value>] [--client-name=<value>] [--jmes-filter=<value>] [--format-output=<value>] [--decode-output=<value>]

Request parameters

The following table describes the required and specific parameters of the pull_log_dump command.
ParameterTypeRequiredExampleDescription
--project_nameStringYesaliyun-test-projectThe name of the project.
--logstore_nameStringYeslogstore-aThe name of the Logstore.
--from_timeStringYes2021-06-01 18:00:00+8:00The start time of the time range that is specified in the request. The start time can be a UNIX timestamp. The start time can also be a value in the "%Y-%m-%d %H:%M:%S<time_zone>" format, for example, “2018-01-02 12:12:10+8:00”.
--to_timeStringYes2021-06-01 18:25:00+8:00The end time of the time range that is specified in the request. The end time can be a UNIX timestamp. The end time can also be a value in the "%Y-%m-%d %H:%M:%S<time_zone>" format, for example, “2018-01-02 12:12:10+8:00”.
--file_pathStringYes/home/dump_{}.jsonThe path in which log data is stored. For example, if you set the parameter to /home/dump_{}.json path, {} is replaced by the ID of a shard in the command output.
--batch_sizeStringNo1000The number of logs that are returned for each query.
--compressBooleanNotrueSpecifies whether to compress the returned log data.
  • true: The returned log data is compressed. This is the default value.
  • false: The returned log data is not compressed.
For information about the global parameters of the Log Service command-line interface (CLI), see Global parameters.

Examples

  • Sample requests
    Use the default account to query log data that is generated within a specified time range and store the data to the /home directory. Run the following command:
    aliyunlog log pull_log_dump --project_name="aliyun-test-project" --logstore_name="logstore-a" --from_time="2021-06-01 18:00:00+8:00" --to_time="2021-06-01 18:25:00+8:00" --file_path="/home/dump_{}.json" --batch_size=1000 --compress=true
  • Sample responses
    {
      "files": {
        "/home/dump_1.json": 1,
        "/home/dump_4.json": 1
      },
      "total_count": 2
    }