Updates a Logtail configuration by using the Log Service CLI.
Request syntax
aliyunlog log update_logtail_config --project_name=<value> --config_detail=<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
Command-specific parameters:
|
Parameter |
Type |
Required |
Example |
Description |
|
--project_name |
String |
Yes |
aliyun-test-project |
The project name. |
|
--config_detail |
String |
Yes |
file://./logtailconfig.json |
The path to the Logtail configuration file. For more information, see Logtail configurations (Legacy). |
For global parameters of the Log Service CLI, see Global parameters.
Examples
-
Prepare the logtailconfig.json file with a configuration named config_name2:
{ "config_name": "config_name2", "logstore_name": "logstore-a", "file_pattern": "file_pattern", "time_format": "time_format", "log_path": "/log_path", "endpoint": "endpoint", "log_parse_regex": "xxx ([\\w\\-]+\\s[\\d\\:]+)\\s+(.*)", "log_begin_regex": "xxx.*", "reg_keys": [ "time", "value" ], "topic_format": "none", "filter_keys": [ "time", "value" ], "filter_keys_reg": [ "time", "value" ], "logSample": "xxx 2017-11-11 11:11:11 hello alicloud." } -
Update config_name2 with the default account:
aliyunlog log update_logtail_config --project_name="aliyun-test-project" --config_detail="file://./logtailconfig.json"This command returns no output.
-
Verify the update by querying the configuration:
aliyunlog log get_logtail_config --project_name="aliyun-test-project" --config_name="config_name2"Sample output:
{ "configName": "config_name2", "createTime": 1719370155, "inputDetail": { "adjustTimezone": false, "delayAlarmBytes": 0, "delaySkipBytes": 0, "discardNonUtf8": false, "discardUnmatch": true, "dockerFile": false, "enableRawLog": false, "enableTag": false, "fileEncoding": "utf8", "filePattern": "file_pattern", "filterKey": [ "time", "value" ], "filterRegex": [ "time", "value" ], "key": [ "time", "value" ], "localStorage": true, "logBeginRegex": "xxx.*", "logPath": "/log_path", "logTimezone": "", "logType": "common_reg_log", "maxDepth": 1000, "maxSendRate": -1, "mergeType": "topic", "preserve": true, "preserveDepth": 0, "priority": 0, "regex": "xxx ([\\w\\-]+\\s[\\d\\:]+)\\s+(.*)", "sendRateExpire": 0, "sensitive_keys": [], "tailExisted": false, "timeFormat": "time_format", "timeKey": "time", "topicFormat": "none" }, "inputType": "file", "lastModifyTime": 1719370155, "logSample": "xxx 2017-11-11 11:11:11 hello alicloud.", "outputDetail": { "endpoint": "cn-hangzhou-intranet.log.aliyuncs.com", "logstoreName": "logstore-a", "region": "cn-hangzhou", "telemetryType": "logs" }, "outputType": "LogService" }
Error codes
If an error is returned, troubleshoot it based on the error codes of the related API. For more information, see Error codes.