aliyun-log-python-sdk 0.7.11__tar.gz → 0.9.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aliyun-log-python-sdk-0.9.6/LICENSE +21 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/PKG-INFO +7 -9
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/__init__.py +2 -2
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/acl_response.py +2 -2
- aliyun-log-python-sdk-0.9.6/aliyun/log/auth.py +178 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/common_response.py +0 -1
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/consumer/checkpoint_tracker.py +0 -1
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/consumer/config.py +10 -1
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/consumer/consumer_client.py +7 -5
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/consumer/shard_worker.py +17 -7
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/consumer/tasks.py +25 -5
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/consumer/worker.py +4 -2
- aliyun-log-python-sdk-0.9.6/aliyun/log/credentials.py +33 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/cursor_response.py +1 -1
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/cursor_time_response.py +1 -1
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/etl_core/config_parser.py +0 -1
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/etl_core/etl_util.py +0 -1
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/etl_core/exceptions.py +0 -1
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/etl_core/restrict_config_parser.py +0 -1
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/etl_core/runner.py +0 -1
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/etl_core/trans_comp/__init__.py +1 -1
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/etl_core/trans_comp/trans_base.py +0 -1
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/etl_core/transform/condition_transform.py +0 -2
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/export_response.py +10 -1
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/ext/jupyter_magic.py +4 -4
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/external_store_config.py +7 -4
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/external_store_config_response.py +5 -5
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/gethistogramsrequest.py +87 -16
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/gethistogramsresponse.py +4 -4
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/getlogsrequest.py +119 -25
- aliyun-log-python-sdk-0.9.6/aliyun/log/getlogsresponse.py +568 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/histogram.py +9 -9
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/index_config.py +7 -7
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/index_config_response.py +4 -4
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/ingestion_response.py +1 -1
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/job.py +33 -3
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/listlogstoresrequest.py +1 -1
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/listlogstoresresponse.py +4 -4
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/listtopicsrequest.py +11 -11
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/listtopicsresponse.py +4 -4
- aliyun-log-python-sdk-0.9.6/aliyun/log/log_logs_pb2.py +33 -0
- aliyun-log-python-sdk-0.9.6/aliyun/log/log_logs_raw_pb2.py +33 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/logclient.py +2050 -293
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/logclient_core.py +0 -1
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/logclient_operator.py +7 -8
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/logexception.py +10 -7
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/logger_hanlder.py +21 -4
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/logitem.py +84 -69
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/logrequest.py +4 -4
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/logresponse.py +5 -5
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/logstore_config_response.py +9 -5
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/logtail_config_detail.py +3 -4
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/logtail_config_response.py +5 -5
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/machine_group_detail.py +4 -5
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/machinegroup_response.py +10 -10
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/project_response.py +6 -1
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/pulllog_response.py +19 -4
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/putlogsrequest.py +15 -15
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/putlogsresponse.py +1 -1
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/queriedlog.py +27 -6
- aliyun-log-python-sdk-0.9.6/aliyun/log/scheduled_sql.py +317 -0
- aliyun-log-python-sdk-0.9.6/aliyun/log/scheduled_sql_response.py +215 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/shard_response.py +2 -2
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/sql_instance_response.py +1 -1
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/substore_config_response.py +5 -5
- aliyun-log-python-sdk-0.9.6/aliyun/log/tag_response.py +46 -0
- aliyun-log-python-sdk-0.9.6/aliyun/log/topostore_params.py +449 -0
- aliyun-log-python-sdk-0.9.6/aliyun/log/topostore_response.py +468 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/util.py +49 -17
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/version.py +1 -1
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun_log_python_sdk.egg-info/PKG-INFO +7 -9
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun_log_python_sdk.egg-info/SOURCES.txt +8 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun_log_python_sdk.egg-info/requires.txt +1 -1
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/setup.py +3 -3
- aliyun-log-python-sdk-0.7.11/aliyun/log/getlogsresponse.py +0 -144
- aliyun-log-python-sdk-0.7.11/aliyun/log/log_logs_pb2.py +0 -251
- aliyun-log-python-sdk-0.7.11/aliyun/log/log_logs_raw_pb2.py +0 -285
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/README.md +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/__init__.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/acl_config.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/consumer/__init__.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/consumer/exceptions.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/consumer/fetched_log_group.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/consumer/heart_beat.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/consumer_group_request.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/consumer_group_response.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/es_migration/__init__.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/es_migration/doc_logitem_converter.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/es_migration/index_logstore_mappings.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/es_migration/mapping_index_converter.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/es_migration/migration_log.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/es_migration/migration_manager.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/es_migration/migration_response.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/es_migration/migration_task.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/es_migration/util.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/etl_config_response.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/etl_core/__init__.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/etl_core/settings.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/etl_core/trans_comp/trans_csv.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/etl_core/trans_comp/trans_json.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/etl_core/trans_comp/trans_kv.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/etl_core/trans_comp/trans_lookup.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/etl_core/trans_comp/trans_mv.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/etl_core/trans_comp/trans_regex.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/etl_core/trans_comp/trans_set_field.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/etl_core/transform/__init__.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/etl_core/transform/condition_list.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/etl_core/transform/condition_util.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/etl_core/transform/transform_base.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/etl_core/transform/transform_list.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/etl_core/transform/transform_meta.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/ext/__init__.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/ext/syslogclient.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/getcontextlogsresponse.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/odps_sink.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/oss_sink.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/pluralize.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/resource_params.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/resource_response.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/shipper_config.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/shipper_response.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/sink.py +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun_log_python_sdk.egg-info/dependency_links.txt +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun_log_python_sdk.egg-info/top_level.txt +0 -0
- {aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/setup.cfg +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 Alibaba Cloud
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
Metadata-Version:
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
2
|
Name: aliyun-log-python-sdk
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.9.6
|
|
4
4
|
Summary: Aliyun log service Python client SDK
|
|
5
5
|
Home-page: https://github.com/aliyun/aliyun-log-python-sdk
|
|
6
6
|
Author: Aliyun
|
|
7
|
-
Author-email: UNKNOWN
|
|
8
|
-
License: UNKNOWN
|
|
9
|
-
Description:
|
|
10
|
-
Python SDK for Alicloud Log Service
|
|
11
|
-
http://aliyun-log-python-sdk.readthedocs.io
|
|
12
|
-
|
|
13
|
-
Platform: UNKNOWN
|
|
14
7
|
Classifier: Development Status :: 5 - Production/Stable
|
|
15
8
|
Classifier: License :: OSI Approved :: MIT License
|
|
16
9
|
Classifier: Operating System :: OS Independent
|
|
@@ -22,3 +15,8 @@ Classifier: Programming Language :: Python :: 3.5
|
|
|
22
15
|
Classifier: Programming Language :: Python :: 3.6
|
|
23
16
|
Classifier: Programming Language :: Python :: 3.7
|
|
24
17
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
Python SDK for Alicloud Log Service
|
|
22
|
+
http://aliyun-log-python-sdk.readthedocs.io
|
|
@@ -13,7 +13,7 @@ from .shipper_config import ShipperTask, OssShipperConfig, OdpsShipperConfig
|
|
|
13
13
|
from .version import __version__
|
|
14
14
|
from .logitem import LogItem
|
|
15
15
|
from .consumer_group_request import *
|
|
16
|
-
from .external_store_config import *
|
|
16
|
+
from .external_store_config import *
|
|
17
17
|
|
|
18
18
|
# response class
|
|
19
19
|
from .consumer_group_response import *
|
|
@@ -32,7 +32,7 @@ from .pulllog_response import PullLogResponse
|
|
|
32
32
|
from .shard_response import *
|
|
33
33
|
from .shipper_response import *
|
|
34
34
|
from .common_response import *
|
|
35
|
-
from .external_store_config_response import *
|
|
35
|
+
from .external_store_config_response import *
|
|
36
36
|
from .log_logs_raw_pb2 import LogGroupRaw as LogGroup
|
|
37
37
|
|
|
38
38
|
# logging handler
|
|
@@ -12,7 +12,7 @@ from .logresponse import LogResponse
|
|
|
12
12
|
|
|
13
13
|
class UpdateAclResponse(LogResponse):
|
|
14
14
|
""" The response of the update_projecta_acl/update_logstore_acl API from log.
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
:type header: dict
|
|
17
17
|
:param header: UpdateAclResponse HTTP response header
|
|
18
18
|
"""
|
|
@@ -27,7 +27,7 @@ class UpdateAclResponse(LogResponse):
|
|
|
27
27
|
|
|
28
28
|
class ListAclResponse(LogResponse):
|
|
29
29
|
""" The response of the get_project_acl/get_logstore_acl API from log.
|
|
30
|
-
|
|
30
|
+
|
|
31
31
|
:type header: dict
|
|
32
32
|
:param header: GetAclResponse HTTP response header
|
|
33
33
|
"""
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# encoding: utf-8
|
|
3
|
+
|
|
4
|
+
# Copyright (C) Alibaba Cloud Computing
|
|
5
|
+
# All rights reserved.
|
|
6
|
+
|
|
7
|
+
import locale
|
|
8
|
+
from hashlib import sha256
|
|
9
|
+
|
|
10
|
+
from .util import *
|
|
11
|
+
|
|
12
|
+
is_py2 = (sys.version_info[0] == 2)
|
|
13
|
+
is_py3 = (sys.version_info[0] == 3)
|
|
14
|
+
|
|
15
|
+
if is_py2:
|
|
16
|
+
def to_bytes(data):
|
|
17
|
+
"""若输入为unicode, 则转为utf-8编码的bytes;其他则原样返回。"""
|
|
18
|
+
if isinstance(data, unicode):
|
|
19
|
+
return data.encode('utf-8')
|
|
20
|
+
else:
|
|
21
|
+
return data
|
|
22
|
+
elif is_py3:
|
|
23
|
+
|
|
24
|
+
def to_bytes(data):
|
|
25
|
+
"""若输入为str(即unicode),则转为utf-8编码的bytes;其他则原样返回"""
|
|
26
|
+
if isinstance(data, str):
|
|
27
|
+
return data.encode(encoding='utf-8')
|
|
28
|
+
else:
|
|
29
|
+
return data
|
|
30
|
+
|
|
31
|
+
AUTH_VERSION_1 = 'v1'
|
|
32
|
+
AUTH_VERSION_4 = 'v4'
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def make_auth(credentials_provider, auth_version=AUTH_VERSION_1, region=''):
|
|
36
|
+
if auth_version == AUTH_VERSION_4:
|
|
37
|
+
return AuthV4(credentials_provider, region)
|
|
38
|
+
else:
|
|
39
|
+
return AuthV1(credentials_provider)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class AuthBase(object):
|
|
43
|
+
def __init__(self, credentials_provider):
|
|
44
|
+
self.credentials_provider = credentials_provider
|
|
45
|
+
|
|
46
|
+
def sign_request(self, method, resource, params, headers, body):
|
|
47
|
+
pass
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class AuthV1(AuthBase):
|
|
51
|
+
|
|
52
|
+
def __init__(self, credentials_provider):
|
|
53
|
+
AuthBase.__init__(self, credentials_provider)
|
|
54
|
+
|
|
55
|
+
@staticmethod
|
|
56
|
+
def _getGMT():
|
|
57
|
+
try:
|
|
58
|
+
locale.setlocale(locale.LC_TIME, "C")
|
|
59
|
+
except Exception as ex:
|
|
60
|
+
logger.warning("failed to set locale time to C. skip it: {0}".format(ex))
|
|
61
|
+
return datetime.utcnow().strftime('%a, %d %b %Y %H:%M:%S GMT')
|
|
62
|
+
|
|
63
|
+
def sign_request(self, method, resource, params, headers, body):
|
|
64
|
+
credentials = self.credentials_provider.get_credentials()
|
|
65
|
+
if credentials.get_security_token():
|
|
66
|
+
headers['x-acs-security-token'] = credentials.get_security_token()
|
|
67
|
+
|
|
68
|
+
headers['x-log-signaturemethod'] = 'hmac-sha1'
|
|
69
|
+
headers['Date'] = self._getGMT()
|
|
70
|
+
|
|
71
|
+
if body:
|
|
72
|
+
headers['Content-MD5'] = Util.cal_md5(body)
|
|
73
|
+
if not credentials.get_access_key_secret():
|
|
74
|
+
return six.b('')
|
|
75
|
+
content = method + '\n'
|
|
76
|
+
if 'Content-MD5' in headers:
|
|
77
|
+
content += headers['Content-MD5']
|
|
78
|
+
content += '\n'
|
|
79
|
+
if 'Content-Type' in headers:
|
|
80
|
+
content += headers['Content-Type']
|
|
81
|
+
content += '\n'
|
|
82
|
+
content += headers['Date'] + '\n'
|
|
83
|
+
content += Util.canonicalized_log_headers(headers)
|
|
84
|
+
content += Util.canonicalized_resource(resource, params)
|
|
85
|
+
signature = Util.hmac_sha1(content, credentials.get_access_key_secret())
|
|
86
|
+
headers['Authorization'] = 'LOG ' + credentials.get_access_key_id() + ':' + signature
|
|
87
|
+
headers['x-log-date'] = headers['Date'] # bypass some proxy doesn't allow "Date" in header issue.
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
class AuthV4(AuthBase):
|
|
91
|
+
def __init__(self, credentials_provider, region):
|
|
92
|
+
AuthBase.__init__(self, credentials_provider)
|
|
93
|
+
self._region = region
|
|
94
|
+
|
|
95
|
+
def sign_request(self, method, resource, params, headers, body):
|
|
96
|
+
current_time = datetime.utcnow().strftime("%Y%m%dT%H%M%SZ")
|
|
97
|
+
headers['Authorization'] = self._do_sign_request(method, resource, params, headers, body, current_time)
|
|
98
|
+
|
|
99
|
+
def _do_sign_request(self, method, resource, params, headers, body, current_time):
|
|
100
|
+
credentials = self.credentials_provider.get_credentials()
|
|
101
|
+
|
|
102
|
+
if credentials.get_security_token():
|
|
103
|
+
headers['x-acs-security-token'] = credentials.get_security_token()
|
|
104
|
+
|
|
105
|
+
content_sha256 = sha256(body).hexdigest() \
|
|
106
|
+
if body else 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
|
|
107
|
+
headers['x-log-content-sha256'] = content_sha256
|
|
108
|
+
headers['x-log-date'] = current_time
|
|
109
|
+
current_date = current_time[:8]
|
|
110
|
+
canonical_headers = {}
|
|
111
|
+
signed_headers = ''
|
|
112
|
+
for original_key, value in headers.items():
|
|
113
|
+
key = original_key.lower()
|
|
114
|
+
if key == 'content-type' or key == 'host' or key.startswith('x-log-') or key.startswith('x-acs-'):
|
|
115
|
+
canonical_headers[key] = value
|
|
116
|
+
headers_to_string = ''
|
|
117
|
+
for key, value in sorted(canonical_headers.items()):
|
|
118
|
+
if len(signed_headers) > 0:
|
|
119
|
+
signed_headers += ';'
|
|
120
|
+
signed_headers += key
|
|
121
|
+
headers_to_string += key + ':' + value.strip() + '\n'
|
|
122
|
+
canonical_request = self.build_canonical_request(method, resource, params, headers_to_string,
|
|
123
|
+
signed_headers, content_sha256)
|
|
124
|
+
scope = current_date + '/' + self._region + '/sls/aliyun_v4_request'
|
|
125
|
+
|
|
126
|
+
string_to_sign = 'SLS4-HMAC-SHA256\n' \
|
|
127
|
+
+ current_time + '\n' \
|
|
128
|
+
+ scope + '\n' \
|
|
129
|
+
+ sha256(canonical_request.encode('utf-8')).hexdigest()
|
|
130
|
+
signature = self.build_sign_key(credentials.get_access_key_secret(),
|
|
131
|
+
self._region, current_date, string_to_sign)
|
|
132
|
+
return 'SLS4-HMAC-SHA256 Credential=%s/%s,Signature=%s' % (credentials.get_access_key_id(), scope, signature)
|
|
133
|
+
|
|
134
|
+
@staticmethod
|
|
135
|
+
def build_canonical_request(method, resource, params, canonical_headers, signed_headers, hashed_payload):
|
|
136
|
+
canonical_string = method + '\n' + resource + '\n'
|
|
137
|
+
order_map = {}
|
|
138
|
+
if params:
|
|
139
|
+
for key, value in params.items():
|
|
140
|
+
order_map[key] = AuthV4._v4_uri_encode(value)
|
|
141
|
+
separator = ''
|
|
142
|
+
canonical_part = ''
|
|
143
|
+
for key, value in sorted(order_map.items()):
|
|
144
|
+
canonical_part += separator + key
|
|
145
|
+
if value:
|
|
146
|
+
canonical_part += '=' + value
|
|
147
|
+
separator = '&'
|
|
148
|
+
canonical_string += canonical_part + '\n'
|
|
149
|
+
canonical_string += canonical_headers + '\n'
|
|
150
|
+
canonical_string += signed_headers + '\n'
|
|
151
|
+
canonical_string += hashed_payload
|
|
152
|
+
return canonical_string
|
|
153
|
+
|
|
154
|
+
@staticmethod
|
|
155
|
+
def _v4_uri_encode(raw_text):
|
|
156
|
+
raw_text = str(raw_text)
|
|
157
|
+
|
|
158
|
+
res = ''
|
|
159
|
+
for b in raw_text:
|
|
160
|
+
if isinstance(b, int):
|
|
161
|
+
c = chr(b)
|
|
162
|
+
else:
|
|
163
|
+
c = b
|
|
164
|
+
if ('A' <= c <= 'Z') or ('a' <= c <= 'z') \
|
|
165
|
+
or ('0' <= c <= '9') or c in ['_', '-', '~', '.']:
|
|
166
|
+
res += c
|
|
167
|
+
else:
|
|
168
|
+
res += "%{0:02X}".format(ord(c))
|
|
169
|
+
return res
|
|
170
|
+
|
|
171
|
+
@staticmethod
|
|
172
|
+
def build_sign_key(key, region, date, string_to_sign):
|
|
173
|
+
sign_key = 'aliyun_v4' + key
|
|
174
|
+
sign_date = hmac.new(sign_key.encode('utf-8'), date.encode('utf-8'), hashlib.sha256).digest()
|
|
175
|
+
sign_region = hmac.new(sign_date, region.encode('utf-8'), hashlib.sha256).digest()
|
|
176
|
+
sign_service = hmac.new(sign_region, 'sls'.encode('utf-8'), hashlib.sha256).digest()
|
|
177
|
+
sign_request = hmac.new(sign_service, 'aliyun_v4_request'.encode('utf-8'), hashlib.sha256).digest()
|
|
178
|
+
return hmac.new(sign_request, string_to_sign.encode('utf-8'), hashlib.sha256).hexdigest()
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
from enum import Enum
|
|
4
4
|
|
|
5
|
+
from aliyun.log.auth import *
|
|
6
|
+
|
|
5
7
|
|
|
6
8
|
class CursorPosition(Enum):
|
|
7
9
|
BEGIN_CURSOR = 'BEGIN_CURSOR'
|
|
@@ -22,7 +24,8 @@ class LogHubConfig(object):
|
|
|
22
24
|
consumer_group_name, consumer_name,
|
|
23
25
|
cursor_position=None, heartbeat_interval=None, data_fetch_interval=None, in_order=False,
|
|
24
26
|
cursor_start_time=None, security_token=None, max_fetch_log_group_size=None, worker_pool_size=None, shared_executor=None,
|
|
25
|
-
cursor_end_time=None, credentials_refresher=None
|
|
27
|
+
cursor_end_time=None, credentials_refresher=None,
|
|
28
|
+
auth_version=AUTH_VERSION_1, region='', query=None):
|
|
26
29
|
"""
|
|
27
30
|
|
|
28
31
|
:param endpoint:
|
|
@@ -42,6 +45,9 @@ class LogHubConfig(object):
|
|
|
42
45
|
:param worker_pool_size: default 2. suggest keep the default size (2), use multiple process instead, when you need to have more concurrent processing, launch this consumer for mulitple times and give them different consuer name in same consumer group. will be ignored when shared_executor is passed.
|
|
43
46
|
:param shared_executor: shared executor, if not None, worker_pool_size will be ignored
|
|
44
47
|
:param cursor_end_time: cursor end time, default is None (never stop processing). could setting it as ISO time-format, when setting it as "end", it means process all logs received from start to the time when the consumer is started.
|
|
48
|
+
:param auth_version: only support AUTH_VERSION_1 and AUTH_VERSION_4
|
|
49
|
+
:param region: region of project
|
|
50
|
+
:param query: the SPL query, such as *| where a = 'xxx'
|
|
45
51
|
"""
|
|
46
52
|
self.endpoint = endpoint
|
|
47
53
|
self.accessKeyId = access_key_id
|
|
@@ -62,3 +68,6 @@ class LogHubConfig(object):
|
|
|
62
68
|
self.consumer_group_time_out = self.heartbeat_interval * 2
|
|
63
69
|
self.cursor_end_time = cursor_end_time or None # default to None
|
|
64
70
|
self.credentials_refresher = credentials_refresher
|
|
71
|
+
self.auth_version = auth_version
|
|
72
|
+
self.region = region
|
|
73
|
+
self.query = query
|
{aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/consumer/consumer_client.py
RENAMED
|
@@ -6,6 +6,7 @@ from .exceptions import CheckPointException
|
|
|
6
6
|
from .exceptions import ClientWorkerException
|
|
7
7
|
from ..logexception import LogException
|
|
8
8
|
from ..version import USER_AGENT
|
|
9
|
+
from ..auth import *
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
class ConsumerClientLoggerAdapter(logging.LoggerAdapter):
|
|
@@ -20,12 +21,13 @@ class ConsumerClientLoggerAdapter(logging.LoggerAdapter):
|
|
|
20
21
|
|
|
21
22
|
class ConsumerClient(object):
|
|
22
23
|
def __init__(self, endpoint, access_key_id, access_key, project,
|
|
23
|
-
logstore, consumer_group, consumer, security_token=None, credentials_refresher=None
|
|
24
|
+
logstore, consumer_group, consumer, security_token=None, credentials_refresher=None,
|
|
25
|
+
auth_version=AUTH_VERSION_1, region=''):
|
|
24
26
|
|
|
25
27
|
from .. import LogClient
|
|
26
28
|
|
|
27
|
-
self.mclient = LogClient(endpoint, access_key_id, access_key, security_token)
|
|
28
|
-
self.mclient.set_user_agent('%s-consumergroup-%s' % (USER_AGENT, consumer_group))
|
|
29
|
+
self.mclient = LogClient(endpoint, access_key_id, access_key, security_token, auth_version=auth_version, region=region)
|
|
30
|
+
self.mclient.set_user_agent('%s-consumergroup-%s-%s' % (USER_AGENT, consumer_group, consumer))
|
|
29
31
|
if credentials_refresher is not None:
|
|
30
32
|
self.mclient.set_credentials_auto_refresher(credentials_refresher)
|
|
31
33
|
self.mproject = project
|
|
@@ -98,5 +100,5 @@ class ConsumerClient(object):
|
|
|
98
100
|
def get_end_cursor(self, shard_id):
|
|
99
101
|
return self.mclient.get_end_cursor(self.mproject, self.mlogstore, shard_id).get_cursor()
|
|
100
102
|
|
|
101
|
-
def pull_logs(self, shard_id, cursor, end_cursor=None, count=1000):
|
|
102
|
-
return self.mclient.pull_logs(self.mproject, self.mlogstore, shard_id, cursor, count, compress=True, end_cursor=end_cursor)
|
|
103
|
+
def pull_logs(self, shard_id, cursor, end_cursor=None, count=1000, query=None):
|
|
104
|
+
return self.mclient.pull_logs(self.mproject, self.mlogstore, shard_id, cursor, count, compress=True, end_cursor=end_cursor,query=query)
|
{aliyun-log-python-sdk-0.7.11 → aliyun-log-python-sdk-0.9.6}/aliyun/log/consumer/shard_worker.py
RENAMED
|
@@ -30,7 +30,7 @@ class ShardConsumerWorkerLoggerAdapter(logging.LoggerAdapter):
|
|
|
30
30
|
|
|
31
31
|
class ShardConsumerWorker(object):
|
|
32
32
|
def __init__(self, log_client, shard_id, consumer_name, processor, cursor_position, cursor_start_time,
|
|
33
|
-
max_fetch_log_group_size=1000, executor=None, cursor_end_time=None):
|
|
33
|
+
max_fetch_log_group_size=1000, executor=None, cursor_end_time=None, query=None):
|
|
34
34
|
self.log_client = log_client
|
|
35
35
|
self.shard_id = shard_id
|
|
36
36
|
self.consumer_name = consumer_name
|
|
@@ -57,10 +57,13 @@ class ShardConsumerWorker(object):
|
|
|
57
57
|
self.last_log_error_time = 0
|
|
58
58
|
self.last_fetch_time = 0
|
|
59
59
|
self.last_fetch_count = 0
|
|
60
|
+
self.last_fetch_size = 0
|
|
61
|
+
self.rawLogGroupCountBeforeQuery = 0
|
|
62
|
+
self.rawSizeBeforeQuery = 0
|
|
60
63
|
self.last_success_fetch_time = 0
|
|
61
64
|
self.last_success_fetch_time_with_data = 0
|
|
62
65
|
self.save_last_checkpoint = False
|
|
63
|
-
|
|
66
|
+
self.query = query
|
|
64
67
|
self.logger = ShardConsumerWorkerLoggerAdapter(
|
|
65
68
|
logging.getLogger(__name__), {"shard_consumer_worker": self})
|
|
66
69
|
|
|
@@ -97,6 +100,9 @@ class ShardConsumerWorker(object):
|
|
|
97
100
|
task_result.get_cursor())
|
|
98
101
|
self.next_fetch_cursor = task_result.get_cursor()
|
|
99
102
|
self.last_fetch_count = self.last_fetch_log_group.log_group_size
|
|
103
|
+
self.last_fetch_size = task_result.get_raw_size()
|
|
104
|
+
self.rawLogGroupCountBeforeQuery = task_result.get_raw_log_group_count_before_query()
|
|
105
|
+
self.rawSizeBeforeQuery = task_result.get_raw_size_before_query()
|
|
100
106
|
if self.last_fetch_count > 0:
|
|
101
107
|
self.last_success_fetch_time_with_data = time.time()
|
|
102
108
|
self.save_last_checkpoint = False
|
|
@@ -113,22 +119,26 @@ class ShardConsumerWorker(object):
|
|
|
113
119
|
if task_result is None or task_result.get_exception() is None:
|
|
114
120
|
# flag to indicate if it's done
|
|
115
121
|
is_generate_fetch_task = True
|
|
122
|
+
fetch_size = self.last_fetch_size
|
|
123
|
+
fetch_count = self.last_fetch_count
|
|
124
|
+
if self.query:
|
|
125
|
+
fetch_size = self.rawSizeBeforeQuery
|
|
126
|
+
fetch_count = self.rawLogGroupCountBeforeQuery
|
|
116
127
|
|
|
117
128
|
# throttling control, similar as Java's SDK
|
|
118
|
-
if
|
|
129
|
+
if fetch_size < 1024 * 1024 and fetch_count < 100 and fetch_count < self.max_fetch_log_group_size:
|
|
119
130
|
is_generate_fetch_task = (time.time() - self.last_fetch_time) > 0.5
|
|
120
|
-
elif
|
|
131
|
+
elif fetch_size < 2 * 1024 * 1024 and fetch_count < 500 and fetch_count < self.max_fetch_log_group_size:
|
|
121
132
|
is_generate_fetch_task = (time.time() - self.last_fetch_time) > 0.2
|
|
122
|
-
elif
|
|
133
|
+
elif fetch_size < 4 * 1024 * 1024 and fetch_count < 1000 and fetch_count < self.max_fetch_log_group_size:
|
|
123
134
|
is_generate_fetch_task = (time.time() - self.last_fetch_time) > 0.05
|
|
124
|
-
|
|
125
135
|
if is_generate_fetch_task:
|
|
126
136
|
self.last_fetch_time = time.time()
|
|
127
137
|
self.fetch_data_future = \
|
|
128
138
|
self.executor.submit(consumer_fetch_task,
|
|
129
139
|
self.log_client, self.shard_id, self.next_fetch_cursor,
|
|
130
140
|
max_fetch_log_group_size=self.max_fetch_log_group_size,
|
|
131
|
-
end_cursor=self.fetch_end_cursor)
|
|
141
|
+
end_cursor=self.fetch_end_cursor, query=self.query)
|
|
132
142
|
else:
|
|
133
143
|
self.fetch_data_future = None
|
|
134
144
|
else:
|
|
@@ -112,10 +112,13 @@ class InitTaskResult(TaskResult):
|
|
|
112
112
|
|
|
113
113
|
|
|
114
114
|
class FetchTaskResult(TaskResult):
|
|
115
|
-
def __init__(self, fetched_log_group_list, cursor):
|
|
115
|
+
def __init__(self, fetched_log_group_list, cursor, raw_size , raw_size_before_query, raw_log_group_count_before_query):
|
|
116
116
|
super(FetchTaskResult, self).__init__(None)
|
|
117
117
|
self.fetched_log_group_list = fetched_log_group_list
|
|
118
118
|
self.cursor = cursor
|
|
119
|
+
self.raw_size = raw_size
|
|
120
|
+
self.raw_size_before_query = raw_size_before_query
|
|
121
|
+
self.raw_log_group_count_before_query = raw_log_group_count_before_query
|
|
119
122
|
|
|
120
123
|
def get_fetched_log_group_list(self):
|
|
121
124
|
return self.fetched_log_group_list
|
|
@@ -123,6 +126,15 @@ class FetchTaskResult(TaskResult):
|
|
|
123
126
|
def get_cursor(self):
|
|
124
127
|
return self.cursor
|
|
125
128
|
|
|
129
|
+
def get_raw_size(self):
|
|
130
|
+
return self.raw_size
|
|
131
|
+
|
|
132
|
+
def get_raw_size_before_query(self):
|
|
133
|
+
return self.raw_size_before_query
|
|
134
|
+
|
|
135
|
+
def get_raw_log_group_count_before_query(self):
|
|
136
|
+
return self.raw_log_group_count_before_query
|
|
137
|
+
|
|
126
138
|
|
|
127
139
|
def consumer_process_task(processor, log_groups, check_point_tracker):
|
|
128
140
|
"""
|
|
@@ -175,23 +187,31 @@ def consumer_initialize_task(processor, consumer_client, shard_id, cursor_positi
|
|
|
175
187
|
return TaskResult(e)
|
|
176
188
|
|
|
177
189
|
|
|
178
|
-
def consumer_fetch_task(loghub_client_adapter, shard_id, cursor, max_fetch_log_group_size=1000, end_cursor=None):
|
|
190
|
+
def consumer_fetch_task(loghub_client_adapter, shard_id, cursor, max_fetch_log_group_size=1000, end_cursor=None, query=None):
|
|
179
191
|
exception = None
|
|
180
192
|
|
|
181
193
|
for retry_times in range(3):
|
|
182
194
|
try:
|
|
183
|
-
response = loghub_client_adapter.pull_logs(shard_id, cursor, count=max_fetch_log_group_size, end_cursor=end_cursor)
|
|
195
|
+
response = loghub_client_adapter.pull_logs(shard_id, cursor, count=max_fetch_log_group_size, end_cursor=end_cursor, query=query)
|
|
184
196
|
fetch_log_group_list = response.get_loggroup_list()
|
|
185
197
|
next_cursor = response.get_next_cursor()
|
|
198
|
+
raw_size = response.get_raw_size()
|
|
199
|
+
raw_size_before_query = 0
|
|
200
|
+
raw_log_group_count_before_query = 0
|
|
201
|
+
if query:
|
|
202
|
+
raw_size_before_query = max(response.get_raw_size_before_query(), 0)
|
|
203
|
+
raw_log_group_count_before_query = max(response.get_raw_log_group_count_before_query(), 0)
|
|
186
204
|
logger.debug("shard id = %s cursor = %s next cursor = %s size: %s",
|
|
187
205
|
shard_id, cursor, next_cursor,
|
|
188
206
|
response.get_log_count())
|
|
189
207
|
if not next_cursor:
|
|
190
|
-
return FetchTaskResult(fetch_log_group_list, cursor)
|
|
208
|
+
return FetchTaskResult(fetch_log_group_list, cursor, raw_size, raw_size_before_query, raw_log_group_count_before_query)
|
|
191
209
|
else:
|
|
192
|
-
return FetchTaskResult(fetch_log_group_list, next_cursor)
|
|
210
|
+
return FetchTaskResult(fetch_log_group_list, next_cursor, raw_size, raw_size_before_query, raw_log_group_count_before_query)
|
|
193
211
|
except LogException as e:
|
|
194
212
|
exception = e
|
|
213
|
+
if exception.get_resp_status() == 403:
|
|
214
|
+
time.sleep(5)
|
|
195
215
|
except Exception as e1:
|
|
196
216
|
logger.error(e1, exc_info=True)
|
|
197
217
|
raise Exception(e1)
|
|
@@ -35,7 +35,8 @@ class ConsumerWorker(Thread):
|
|
|
35
35
|
ConsumerClient(consumer_option.endpoint, consumer_option.accessKeyId, consumer_option.accessKey,
|
|
36
36
|
consumer_option.project, consumer_option.logstore, consumer_option.consumer_group_name,
|
|
37
37
|
consumer_option.consumer_name, consumer_option.securityToken,
|
|
38
|
-
credentials_refresher=consumer_option.credentials_refresher
|
|
38
|
+
credentials_refresher=consumer_option.credentials_refresher,
|
|
39
|
+
auth_version=consumer_option.auth_version, region=consumer_option.region)
|
|
39
40
|
self.shut_down_flag = False
|
|
40
41
|
self.logger = ConsumerWorkerLoggerAdapter(
|
|
41
42
|
logging.getLogger(__name__), {"consumer_worker": self})
|
|
@@ -195,6 +196,7 @@ class ConsumerWorker(Thread):
|
|
|
195
196
|
self.option.cursor_position, self.option.cursor_start_time,
|
|
196
197
|
executor=self._executor,
|
|
197
198
|
cursor_end_time=self.option.cursor_end_time,
|
|
198
|
-
max_fetch_log_group_size=self.option.max_fetch_log_group_size
|
|
199
|
+
max_fetch_log_group_size=self.option.max_fetch_log_group_size,
|
|
200
|
+
query=self.option.query)
|
|
199
201
|
self.shard_consumers[shard_id] = consumer
|
|
200
202
|
return consumer
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# encoding: utf-8
|
|
3
|
+
|
|
4
|
+
# Copyright (C) Alibaba Cloud Computing
|
|
5
|
+
# All rights reserved.
|
|
6
|
+
|
|
7
|
+
class Credentials(object):
|
|
8
|
+
def __init__(self, access_key_id, access_key_secret, security_token=None):
|
|
9
|
+
self.access_key_id = access_key_id
|
|
10
|
+
self.access_key_secret = access_key_secret
|
|
11
|
+
self.security_token = security_token
|
|
12
|
+
|
|
13
|
+
def get_access_key_id(self):
|
|
14
|
+
return self.access_key_id
|
|
15
|
+
|
|
16
|
+
def get_access_key_secret(self):
|
|
17
|
+
return self.access_key_secret
|
|
18
|
+
|
|
19
|
+
def get_security_token(self):
|
|
20
|
+
return self.security_token
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class CredentialsProvider(object):
|
|
24
|
+
def get_credentials(self):
|
|
25
|
+
return
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class StaticCredentialsProvider(CredentialsProvider):
|
|
29
|
+
def __init__(self, access_key_id="", access_key_secret="", security_token=""):
|
|
30
|
+
self.credentials = Credentials(access_key_id, access_key_secret, security_token)
|
|
31
|
+
|
|
32
|
+
def get_credentials(self):
|
|
33
|
+
return self.credentials
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
from .logresponse import LogResponse
|
|
9
9
|
from .util import Util
|
|
10
10
|
|
|
11
|
-
__all__ = ['CreateExportResponse', 'DeleteExportResponse', 'GetExportResponse', 'ListExportResponse']
|
|
11
|
+
__all__ = ['CreateExportResponse', 'DeleteExportResponse', 'GetExportResponse', 'ListExportResponse', 'UpdateExportResponse']
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class CreateExportResponse(LogResponse):
|
|
@@ -32,6 +32,15 @@ class DeleteExportResponse(LogResponse):
|
|
|
32
32
|
print('headers:', self.get_all_headers())
|
|
33
33
|
|
|
34
34
|
|
|
35
|
+
class UpdateExportResponse(LogResponse):
|
|
36
|
+
def __init__(self, header, resp=''):
|
|
37
|
+
LogResponse.__init__(self, header, resp)
|
|
38
|
+
|
|
39
|
+
def log_print(self):
|
|
40
|
+
print('UpdateExportResponse:')
|
|
41
|
+
print('headers:', self.get_all_headers())
|
|
42
|
+
|
|
43
|
+
|
|
35
44
|
class GetExportResponse(LogResponse):
|
|
36
45
|
""" The response of the get_export API from log.
|
|
37
46
|
|