pull_log_dump

Updated at:

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 describes the required parameters for this command.

Parameter Name

Numeric Type

Required

Example

Description

--project_name

String

Yes

aliyun-test-project

The name of the project.

--logstore_name

String

Yes

logstore-a

The name of the Logstore.

--from_time

String

Yes

2021-06-01 18:00:00+8:00

The start of the time range to query. The time can be in UNIX timestamp format or the “%Y-%m-%d %H:%M:%S<time_zone>” format. For example, “2018-01-02 12:12:10+8:00”.

--to_time

String

Yes

2021-06-01 18:25:00+8:00

The end of the time range to query. The time can be in UNIX timestamp format or the “%Y-%m-%d %H:%M:%S<time_zone>” format. For example, “2018-01-02 12:12:10+8:00”.

--file_path

String

Yes

/home/dump_{}.json

The path to save the log data. For example, /home/dump_{}.json. The {} placeholder is replaced with the shard ID.

--batch_size

String

No

1000

The number of logs to retrieve in each query iteration.

--compress

Boolean

No

true

Specifies whether to compress the returned log data.

  • true (default): The log data is compressed.

  • false: Returns uncompressed data.

For information about global parameters, see Global parameters.

Examples

  • Request example

    Query log data from a specified time range and save it to the /home directory.

    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
  • Response example

    {
      "files": {
        "/home/dump_1.json": 1,
        "/home/dump_4.json": 1
      },
      "total_count": 2
    }