aliyun-log-python-sdk 0.9.26__tar.gz → 0.9.28__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.26/aliyun_log_python_sdk.egg-info → aliyun_log_python_sdk-0.9.28}/PKG-INFO +1 -1
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/__init__.py +6 -1
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/consumer/config.py +3 -1
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/consumer/consumer_client.py +2 -2
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/consumer/shard_worker.py +6 -3
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/consumer/tasks.py +3 -3
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/consumer/worker.py +2 -1
- aliyun_log_python_sdk-0.9.28/aliyun/log/deletelogsrequest.py +113 -0
- aliyun_log_python_sdk-0.9.28/aliyun/log/deletelogssresponse.py +32 -0
- aliyun_log_python_sdk-0.9.28/aliyun/log/getdeletelogsstatusrequest.py +57 -0
- aliyun_log_python_sdk-0.9.28/aliyun/log/getdeletelogsstatusresponse.py +37 -0
- aliyun_log_python_sdk-0.9.28/aliyun/log/listdeletelogsstasksrequest.py +37 -0
- aliyun_log_python_sdk-0.9.28/aliyun/log/listdeletelogsstasksresponse.py +53 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/logclient.py +154 -10
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/logclient_operator.py +192 -5
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/version.py +1 -1
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28/aliyun_log_python_sdk.egg-info}/PKG-INFO +1 -1
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun_log_python_sdk.egg-info/SOURCES.txt +6 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/LICENSE +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/README.md +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/__init__.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/_proto_py2/__init__.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/_proto_py2/log_logs_pb2.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/_proto_py2/log_logs_raw_pb2.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/acl_config.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/acl_response.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/auth.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/common_response.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/compress.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/consumer/__init__.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/consumer/checkpoint_tracker.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/consumer/exceptions.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/consumer/fetched_log_group.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/consumer/heart_beat.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/consumer_group_request.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/consumer_group_response.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/credentials.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/cursor_response.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/cursor_time_response.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/es_migration/__init__.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/es_migration/doc_logitem_converter.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/es_migration/index_logstore_mappings.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/es_migration/mapping_index_converter.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/es_migration/migration_log.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/es_migration/migration_manager.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/es_migration/migration_response.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/es_migration/migration_task.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/es_migration/util.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/etl_config_response.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/etl_core/__init__.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/etl_core/config_parser.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/etl_core/etl_util.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/etl_core/exceptions.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/etl_core/restrict_config_parser.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/etl_core/runner.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/etl_core/settings.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/etl_core/trans_comp/__init__.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/etl_core/trans_comp/trans_base.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/etl_core/trans_comp/trans_csv.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/etl_core/trans_comp/trans_json.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/etl_core/trans_comp/trans_kv.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/etl_core/trans_comp/trans_lookup.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/etl_core/trans_comp/trans_mv.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/etl_core/trans_comp/trans_regex.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/etl_core/trans_comp/trans_set_field.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/etl_core/transform/__init__.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/etl_core/transform/condition_list.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/etl_core/transform/condition_transform.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/etl_core/transform/condition_util.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/etl_core/transform/transform_base.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/etl_core/transform/transform_list.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/etl_core/transform/transform_meta.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/export_response.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/ext/__init__.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/ext/jupyter_magic.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/ext/syslogclient.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/external_store_config.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/external_store_config_response.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/getcontextlogsresponse.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/gethistogramsrequest.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/gethistogramsresponse.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/getlogsrequest.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/getlogsresponse.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/histogram.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/index_config.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/index_config_response.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/ingestion_response.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/job.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/listlogstoresrequest.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/listlogstoresresponse.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/listtopicsrequest.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/listtopicsresponse.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/log_logs_pb2.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/log_logs_raw_pb2.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/logclient_core.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/logexception.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/logger_hanlder.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/logitem.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/logrequest.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/logresponse.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/logstore_config_response.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/logtail_config_detail.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/logtail_config_response.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/machine_group_detail.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/machinegroup_response.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/metering_mode_response.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/odps_sink.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/oss_sink.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/pluralize.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/project_response.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/proto.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/pulllog_response.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/putlogsrequest.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/putlogsresponse.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/queriedlog.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/rebuild_index_response.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/resource_params.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/resource_response.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/scheduled_sql.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/scheduled_sql_response.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/shard_response.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/shipper_config.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/shipper_response.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/sink.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/sql_instance_response.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/store_view.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/store_view_response.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/substore_config_response.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/tag_response.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/topostore_params.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/topostore_response.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/util.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun_log_python_sdk.egg-info/dependency_links.txt +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun_log_python_sdk.egg-info/requires.txt +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun_log_python_sdk.egg-info/top_level.txt +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/setup.cfg +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/setup.py +0 -0
- {aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/tests/test_alert.py +0 -0
|
@@ -35,7 +35,12 @@ from .common_response import *
|
|
|
35
35
|
from .external_store_config_response import *
|
|
36
36
|
from .proto import LogGroupRaw as LogGroup
|
|
37
37
|
from .rebuild_index_response import *
|
|
38
|
-
|
|
38
|
+
from .deletelogsrequest import *
|
|
39
|
+
from .deletelogssresponse import *
|
|
40
|
+
from .getdeletelogsstatusrequest import *
|
|
41
|
+
from .getdeletelogsstatusresponse import *
|
|
42
|
+
from .listdeletelogsstasksrequest import *
|
|
43
|
+
from .listdeletelogsstasksresponse import *
|
|
39
44
|
# logging handler
|
|
40
45
|
from .logger_hanlder import SimpleLogHandler, QueuedLogHandler, LogFields, UwsgiQueuedLogHandler
|
|
41
46
|
from .metering_mode_response import GetLogStoreMeteringModeResponse, \
|
|
@@ -26,7 +26,7 @@ class LogHubConfig(object):
|
|
|
26
26
|
cursor_start_time=None, security_token=None, max_fetch_log_group_size=None, worker_pool_size=None, shared_executor=None,
|
|
27
27
|
cursor_end_time=None, credentials_refresher=None,
|
|
28
28
|
auth_version=AUTH_VERSION_1, region='', query=None,
|
|
29
|
-
accept_compress_type=None):
|
|
29
|
+
accept_compress_type=None, processor=None):
|
|
30
30
|
"""
|
|
31
31
|
|
|
32
32
|
:param endpoint:
|
|
@@ -49,6 +49,7 @@ class LogHubConfig(object):
|
|
|
49
49
|
:param auth_version: only support AUTH_VERSION_1 and AUTH_VERSION_4
|
|
50
50
|
:param region: region of project
|
|
51
51
|
:param query: the SPL query, such as *| where a = 'xxx'
|
|
52
|
+
:param processor: the consume processor which contains SPL, such as consume-processor-1
|
|
52
53
|
:type accept_compress_type: string
|
|
53
54
|
:param accept_compress_type: The compression type used for logs retrieved from sls.
|
|
54
55
|
Supported types include 'lz4' and 'zstd'. If you choose 'zstd', ensure the `zstd` library is installed via pip. The default value is 'lz4'.
|
|
@@ -77,3 +78,4 @@ class LogHubConfig(object):
|
|
|
77
78
|
self.region = region
|
|
78
79
|
self.query = query
|
|
79
80
|
self.accept_compress_type = accept_compress_type
|
|
81
|
+
self.processor = processor
|
{aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/consumer/consumer_client.py
RENAMED
|
@@ -179,5 +179,5 @@ class ConsumerClient(object):
|
|
|
179
179
|
def get_end_cursor(self, shard_id):
|
|
180
180
|
return self.mclient.get_end_cursor(self.mproject, self.mlogstore, shard_id).get_cursor()
|
|
181
181
|
|
|
182
|
-
def pull_logs(self, shard_id, cursor, end_cursor=None, count=1000, query=None):
|
|
183
|
-
return self.mclient.pull_logs(self.mproject, self.mlogstore, shard_id, cursor, count, compress=True, end_cursor=end_cursor, query=query, accept_compress_type=self.accept_compress_type)
|
|
182
|
+
def pull_logs(self, shard_id, cursor, end_cursor=None, count=1000, query=None, processor=None):
|
|
183
|
+
return self.mclient.pull_logs(self.mproject, self.mlogstore, shard_id, cursor, count, compress=True, end_cursor=end_cursor, query=query, accept_compress_type=self.accept_compress_type, processor=processor)
|
{aliyun_log_python_sdk-0.9.26 → aliyun_log_python_sdk-0.9.28}/aliyun/log/consumer/shard_worker.py
RENAMED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import copy
|
|
4
4
|
import logging
|
|
5
|
+
from platform import processor
|
|
5
6
|
import time
|
|
6
7
|
|
|
7
8
|
from .checkpoint_tracker import ConsumerCheckpointTracker
|
|
@@ -30,7 +31,7 @@ class ShardConsumerWorkerLoggerAdapter(logging.LoggerAdapter):
|
|
|
30
31
|
|
|
31
32
|
class ShardConsumerWorker(object):
|
|
32
33
|
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, query=None):
|
|
34
|
+
max_fetch_log_group_size=1000, executor=None, cursor_end_time=None, query=None, consume_processor=None):
|
|
34
35
|
self.log_client = log_client
|
|
35
36
|
self.shard_id = shard_id
|
|
36
37
|
self.consumer_name = consumer_name
|
|
@@ -64,6 +65,7 @@ class ShardConsumerWorker(object):
|
|
|
64
65
|
self.last_success_fetch_time_with_data = 0
|
|
65
66
|
self.save_last_checkpoint = False
|
|
66
67
|
self.query = query
|
|
68
|
+
self.consume_processor = consume_processor
|
|
67
69
|
self.logger = ShardConsumerWorkerLoggerAdapter(
|
|
68
70
|
logging.getLogger(__name__), {"shard_consumer_worker": self})
|
|
69
71
|
|
|
@@ -121,7 +123,7 @@ class ShardConsumerWorker(object):
|
|
|
121
123
|
is_generate_fetch_task = True
|
|
122
124
|
fetch_size = self.last_fetch_size
|
|
123
125
|
fetch_count = self.last_fetch_count
|
|
124
|
-
if self.query:
|
|
126
|
+
if self.query or self.consume_processor:
|
|
125
127
|
fetch_size = self.rawSizeBeforeQuery
|
|
126
128
|
fetch_count = self.rawLogGroupCountBeforeQuery
|
|
127
129
|
|
|
@@ -138,7 +140,8 @@ class ShardConsumerWorker(object):
|
|
|
138
140
|
self.executor.submit(consumer_fetch_task,
|
|
139
141
|
self.log_client, self.shard_id, self.next_fetch_cursor,
|
|
140
142
|
max_fetch_log_group_size=self.max_fetch_log_group_size,
|
|
141
|
-
end_cursor=self.fetch_end_cursor, query=self.query
|
|
143
|
+
end_cursor=self.fetch_end_cursor, query=self.query,
|
|
144
|
+
consume_processor=self.consume_processor)
|
|
142
145
|
else:
|
|
143
146
|
self.fetch_data_future = None
|
|
144
147
|
else:
|
|
@@ -187,18 +187,18 @@ def consumer_initialize_task(processor, consumer_client, shard_id, cursor_positi
|
|
|
187
187
|
return TaskResult(e)
|
|
188
188
|
|
|
189
189
|
|
|
190
|
-
def consumer_fetch_task(loghub_client_adapter, shard_id, cursor, max_fetch_log_group_size=1000, end_cursor=None, query=None):
|
|
190
|
+
def consumer_fetch_task(loghub_client_adapter, shard_id, cursor, max_fetch_log_group_size=1000, end_cursor=None, query=None, consume_processor=None):
|
|
191
191
|
exception = None
|
|
192
192
|
|
|
193
193
|
for retry_times in range(3):
|
|
194
194
|
try:
|
|
195
|
-
response = loghub_client_adapter.pull_logs(shard_id, cursor, count=max_fetch_log_group_size, end_cursor=end_cursor, query=query)
|
|
195
|
+
response = loghub_client_adapter.pull_logs(shard_id, cursor, count=max_fetch_log_group_size, end_cursor=end_cursor, query=query, processor=consume_processor)
|
|
196
196
|
fetch_log_group_list = response.get_loggroup_list()
|
|
197
197
|
next_cursor = response.get_next_cursor()
|
|
198
198
|
raw_size = response.get_raw_size()
|
|
199
199
|
raw_size_before_query = 0
|
|
200
200
|
raw_log_group_count_before_query = 0
|
|
201
|
-
if query:
|
|
201
|
+
if query or consume_processor:
|
|
202
202
|
raw_size_before_query = max(response.get_raw_size_before_query(), 0)
|
|
203
203
|
raw_log_group_count_before_query = max(response.get_raw_log_group_count_before_query(), 0)
|
|
204
204
|
logger.debug("shard id = %s cursor = %s next cursor = %s size: %s",
|
|
@@ -198,6 +198,7 @@ class ConsumerWorker(Thread):
|
|
|
198
198
|
executor=self._executor,
|
|
199
199
|
cursor_end_time=self.option.cursor_end_time,
|
|
200
200
|
max_fetch_log_group_size=self.option.max_fetch_log_group_size,
|
|
201
|
-
query=self.option.query
|
|
201
|
+
query=self.option.query,
|
|
202
|
+
consume_processor=self.option.processor)
|
|
202
203
|
self.shard_consumers[shard_id] = consumer
|
|
203
204
|
return consumer
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# encoding: utf-8
|
|
3
|
+
|
|
4
|
+
# Copyright (C) Alibaba Cloud Computing
|
|
5
|
+
# All rights reserved.
|
|
6
|
+
|
|
7
|
+
from .logrequest import LogRequest
|
|
8
|
+
from .util import parse_timestamp
|
|
9
|
+
|
|
10
|
+
class DeleteLogsRequest(LogRequest):
|
|
11
|
+
""" The request used to get histograms of a query from log.
|
|
12
|
+
|
|
13
|
+
:type project: string
|
|
14
|
+
:param project: project name
|
|
15
|
+
|
|
16
|
+
:type logstore: string
|
|
17
|
+
:param logstore: logstore name
|
|
18
|
+
|
|
19
|
+
:type fromTime: int/string
|
|
20
|
+
:param fromTime: the begin time or format of time in readable time like "%Y-%m-%d %H:%M:%S<time_zone>" e.g. "2018-01-02 12:12:10+8:00" e.g. "2018-01-02 12:12:10", also support human readable string, e.g. "1 hour ago", "now", "yesterday 0:0:0", refer to https://aliyun-log-cli.readthedocs.io/en/latest/tutorials/tutorial_human_readable_datetime.html
|
|
21
|
+
|
|
22
|
+
:type toTime: int/string
|
|
23
|
+
:param toTime: the end time or format of time in readable time like "%Y-%m-%d %H:%M:%S<time_zone>" e.g. "2018-01-02 12:12:10+8:00" e.g. "2018-01-02 12:12:10", also support human readable string, e.g. "1 hour ago", "now", "yesterday 0:0:0", refer to https://aliyun-log-cli.readthedocs.io/en/latest/tutorials/tutorial_human_readable_datetime.html
|
|
24
|
+
|
|
25
|
+
:type topic: string
|
|
26
|
+
:param topic: topic name of logs
|
|
27
|
+
|
|
28
|
+
:type query: string
|
|
29
|
+
:param query: user defined query
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
def __init__(self, project=None, logstore=None, fromTime=None, toTime=None, topic=None, query=None):
|
|
33
|
+
LogRequest.__init__(self, project)
|
|
34
|
+
self.logstore = logstore
|
|
35
|
+
self.fromTime = parse_timestamp(fromTime)
|
|
36
|
+
self.toTime = parse_timestamp(toTime)
|
|
37
|
+
self.topic = topic
|
|
38
|
+
self.query = query
|
|
39
|
+
|
|
40
|
+
def get_logstore(self):
|
|
41
|
+
""" Get logstore name
|
|
42
|
+
|
|
43
|
+
:return: string, logstore name.
|
|
44
|
+
"""
|
|
45
|
+
return self.logstore if self.logstore else ''
|
|
46
|
+
|
|
47
|
+
def set_logstore(self, logstore):
|
|
48
|
+
""" Set logstore name
|
|
49
|
+
|
|
50
|
+
:type logstore: string
|
|
51
|
+
:param logstore: logstore name
|
|
52
|
+
"""
|
|
53
|
+
self.logstore = logstore
|
|
54
|
+
|
|
55
|
+
def get_topic(self):
|
|
56
|
+
""" Get topic name
|
|
57
|
+
|
|
58
|
+
:return: string, topic name
|
|
59
|
+
"""
|
|
60
|
+
return self.topic if self.topic else ''
|
|
61
|
+
|
|
62
|
+
def set_topic(self, topic):
|
|
63
|
+
""" Set topic name
|
|
64
|
+
|
|
65
|
+
:type topic: string
|
|
66
|
+
:param topic: topic name
|
|
67
|
+
"""
|
|
68
|
+
self.topic = topic
|
|
69
|
+
|
|
70
|
+
def get_from(self):
|
|
71
|
+
""" Get begin time
|
|
72
|
+
|
|
73
|
+
:return: int, begin time
|
|
74
|
+
"""
|
|
75
|
+
return self.fromTime
|
|
76
|
+
|
|
77
|
+
def set_from(self, fromTime):
|
|
78
|
+
""" Set begin time
|
|
79
|
+
|
|
80
|
+
:type fromTime: int
|
|
81
|
+
:param fromTime: begin time
|
|
82
|
+
"""
|
|
83
|
+
self.fromTime = fromTime
|
|
84
|
+
|
|
85
|
+
def get_to(self):
|
|
86
|
+
""" Get end time
|
|
87
|
+
|
|
88
|
+
:return: int, end time
|
|
89
|
+
"""
|
|
90
|
+
return self.toTime
|
|
91
|
+
|
|
92
|
+
def set_to(self, toTime):
|
|
93
|
+
""" Set end time
|
|
94
|
+
|
|
95
|
+
:type toTime: int
|
|
96
|
+
:param toTime: end time
|
|
97
|
+
"""
|
|
98
|
+
self.toTime = toTime
|
|
99
|
+
|
|
100
|
+
def get_query(self):
|
|
101
|
+
""" Get user defined query
|
|
102
|
+
|
|
103
|
+
:return: string, user defined query
|
|
104
|
+
"""
|
|
105
|
+
return self.query
|
|
106
|
+
|
|
107
|
+
def set_query(self, query):
|
|
108
|
+
""" Set user defined query
|
|
109
|
+
|
|
110
|
+
:type query: string
|
|
111
|
+
:param query: user defined query
|
|
112
|
+
"""
|
|
113
|
+
self.query = query
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# encoding: utf-8
|
|
3
|
+
|
|
4
|
+
# Copyright (C) Alibaba Cloud Computing
|
|
5
|
+
# All rights reserved.
|
|
6
|
+
|
|
7
|
+
from .logresponse import LogResponse
|
|
8
|
+
from .histogram import Histogram
|
|
9
|
+
from .util import Util
|
|
10
|
+
import json
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class DeleteLogsResponse(LogResponse):
|
|
14
|
+
""" The response of the DeleteLogs API from log.
|
|
15
|
+
|
|
16
|
+
:type resp: dict
|
|
17
|
+
:param resp: DeleteLogsResponse HTTP response body
|
|
18
|
+
|
|
19
|
+
:type header: dict
|
|
20
|
+
:param header: DeleteLogsResponse HTTP response header
|
|
21
|
+
"""
|
|
22
|
+
def __init__(self, resp, header):
|
|
23
|
+
LogResponse.__init__(self, header, resp)
|
|
24
|
+
self.taskid = resp.get('taskId')
|
|
25
|
+
|
|
26
|
+
def get_taskid(self):
|
|
27
|
+
return self.taskid
|
|
28
|
+
|
|
29
|
+
def log_print(self):
|
|
30
|
+
print('DeleteLogsResponse:')
|
|
31
|
+
print('headers:', self.get_all_headers())
|
|
32
|
+
print('taskid:', self.taskid)
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# encoding: utf-8
|
|
3
|
+
|
|
4
|
+
# Copyright (C) Alibaba Cloud Computing
|
|
5
|
+
# All rights reserved.
|
|
6
|
+
|
|
7
|
+
from .logrequest import LogRequest
|
|
8
|
+
from .util import parse_timestamp
|
|
9
|
+
|
|
10
|
+
class GetDeleteLogsStatusRequest(LogRequest):
|
|
11
|
+
""" The request used to get histograms of a query from log.
|
|
12
|
+
|
|
13
|
+
:type project: string
|
|
14
|
+
:param project: project name
|
|
15
|
+
|
|
16
|
+
:type logstore: string
|
|
17
|
+
:param logstore: logstore name
|
|
18
|
+
|
|
19
|
+
:type taskid: string
|
|
20
|
+
:param taskid: delete query taskid
|
|
21
|
+
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
def __init__(self, project=None, logstore=None, taskid=None):
|
|
25
|
+
LogRequest.__init__(self, project)
|
|
26
|
+
self.logstore = logstore
|
|
27
|
+
self.taskid = taskid
|
|
28
|
+
def get_logstore(self):
|
|
29
|
+
""" Get logstore name
|
|
30
|
+
|
|
31
|
+
:return: string, logstore name.
|
|
32
|
+
"""
|
|
33
|
+
return self.logstore if self.logstore else ''
|
|
34
|
+
|
|
35
|
+
def set_logstore(self, logstore):
|
|
36
|
+
""" Set logstore name
|
|
37
|
+
|
|
38
|
+
:type logstore: string
|
|
39
|
+
:param logstore: logstore name
|
|
40
|
+
"""
|
|
41
|
+
self.logstore = logstore
|
|
42
|
+
|
|
43
|
+
def get_taskid(self):
|
|
44
|
+
""" Get taskid name
|
|
45
|
+
|
|
46
|
+
:return: string, taskid name.
|
|
47
|
+
"""
|
|
48
|
+
return self.taskid if self.taskid else ''
|
|
49
|
+
|
|
50
|
+
def set_taskid(self, taskid):
|
|
51
|
+
""" Set taskid name
|
|
52
|
+
|
|
53
|
+
:type taskid: string
|
|
54
|
+
:param taskid: taskid name
|
|
55
|
+
"""
|
|
56
|
+
self.taskid = taskid
|
|
57
|
+
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# encoding: utf-8
|
|
3
|
+
|
|
4
|
+
# Copyright (C) Alibaba Cloud Computing
|
|
5
|
+
# All rights reserved.
|
|
6
|
+
|
|
7
|
+
from .logresponse import LogResponse
|
|
8
|
+
|
|
9
|
+
class GetDeleteLogsStatusResponse(LogResponse):
|
|
10
|
+
""" The response of the GetDeleteLogsStatus API from log.
|
|
11
|
+
|
|
12
|
+
:type resp: dict
|
|
13
|
+
:param resp: GetDeleteLogsStatusResponse HTTP response body
|
|
14
|
+
|
|
15
|
+
:type header: dict
|
|
16
|
+
:param header: GetDeleteLogsStatusResponse HTTP response header
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
def __init__(self, resp, header):
|
|
20
|
+
LogResponse.__init__(self, header, resp)
|
|
21
|
+
self.process = resp['progress']
|
|
22
|
+
|
|
23
|
+
def is_completed(self):
|
|
24
|
+
""" Check if the histogram is completed
|
|
25
|
+
|
|
26
|
+
:return: bool, true if this histogram is completed
|
|
27
|
+
"""
|
|
28
|
+
return self.process == 100.0
|
|
29
|
+
|
|
30
|
+
def get_process(self):
|
|
31
|
+
return self.process
|
|
32
|
+
|
|
33
|
+
def log_print(self):
|
|
34
|
+
print('GetDeleteLogsStatusResponse:')
|
|
35
|
+
print('headers:', self.get_all_headers())
|
|
36
|
+
print('progress:', self.process)
|
|
37
|
+
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# encoding: utf-8
|
|
3
|
+
|
|
4
|
+
# Copyright (C) Alibaba Cloud Computing
|
|
5
|
+
# All rights reserved.
|
|
6
|
+
|
|
7
|
+
from .logrequest import LogRequest
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ListDeleteLogsTasksRequest(LogRequest):
|
|
11
|
+
""" The request used to list delete logs tasks from log.
|
|
12
|
+
|
|
13
|
+
:type project: string
|
|
14
|
+
:param project: project name
|
|
15
|
+
|
|
16
|
+
:type logstore: string
|
|
17
|
+
:param logstore: logstore name
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
def __init__(self, project=None, logstore=None):
|
|
21
|
+
LogRequest.__init__(self, project)
|
|
22
|
+
self.logstore = logstore
|
|
23
|
+
|
|
24
|
+
def get_logstore(self):
|
|
25
|
+
""" Get logstore name
|
|
26
|
+
|
|
27
|
+
:return: string, logstore name.
|
|
28
|
+
"""
|
|
29
|
+
return self.logstore if self.logstore else ''
|
|
30
|
+
|
|
31
|
+
def set_logstore(self, logstore):
|
|
32
|
+
""" Set logstore name
|
|
33
|
+
|
|
34
|
+
:type logstore: string
|
|
35
|
+
:param logstore: logstore name
|
|
36
|
+
"""
|
|
37
|
+
self.logstore = logstore
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# encoding: utf-8
|
|
3
|
+
|
|
4
|
+
# Copyright (C) Alibaba Cloud Computing
|
|
5
|
+
# All rights reserved.
|
|
6
|
+
|
|
7
|
+
from .logresponse import LogResponse
|
|
8
|
+
from .util import Util
|
|
9
|
+
import json
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ListDeleteLogsTasksResponse(LogResponse):
|
|
13
|
+
""" The response of the ListDeleteLogsTasks API from log.
|
|
14
|
+
|
|
15
|
+
:type resp: dict
|
|
16
|
+
:param resp: ListDeleteLogsTasksResponse HTTP response body
|
|
17
|
+
|
|
18
|
+
:type header: dict
|
|
19
|
+
:param header: ListDeleteLogsTasksResponse HTTP response header
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
def __init__(self, resp, header):
|
|
23
|
+
LogResponse.__init__(self, header, resp)
|
|
24
|
+
self.count = resp.get('count', 0)
|
|
25
|
+
self.total = resp.get('total', 0)
|
|
26
|
+
self.task_list = resp.get('tasks', [])
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def is_completed(self):
|
|
30
|
+
""" Check if the request is completed
|
|
31
|
+
|
|
32
|
+
:return: bool, true if this request is completed
|
|
33
|
+
"""
|
|
34
|
+
# 根据实际数据,当所有任务都完成时(进度为100%)表示完成
|
|
35
|
+
if not self.task_list:
|
|
36
|
+
return False
|
|
37
|
+
return all(task.get('progress', 0) == 100 for task in self.task_list)
|
|
38
|
+
|
|
39
|
+
def get_task_list(self):
|
|
40
|
+
return self.task_list
|
|
41
|
+
|
|
42
|
+
def get_count(self):
|
|
43
|
+
return self.count
|
|
44
|
+
|
|
45
|
+
def get_total(self):
|
|
46
|
+
return self.total
|
|
47
|
+
|
|
48
|
+
def log_print(self):
|
|
49
|
+
print('ListDeleteLogsTasksResponse:')
|
|
50
|
+
print('headers:', self.get_all_headers())
|
|
51
|
+
print('count:', self.count)
|
|
52
|
+
print('total:', self.total)
|
|
53
|
+
print('task_list:', self.task_list)
|