aliyun-log-python-sdk 0.9.5__tar.gz → 0.9.7__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.
Files changed (123) hide show
  1. {aliyun-log-python-sdk-0.9.5/aliyun_log_python_sdk.egg-info → aliyun-log-python-sdk-0.9.7}/PKG-INFO +1 -8
  2. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/es_migration/mapping_index_converter.py +6 -2
  3. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/es_migration/migration_task.py +26 -9
  4. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/export_response.py +10 -1
  5. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/getlogsresponse.py +127 -134
  6. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/index_config.py +5 -0
  7. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/logclient.py +23 -1
  8. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/version.py +1 -1
  9. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7/aliyun_log_python_sdk.egg-info}/PKG-INFO +1 -8
  10. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/LICENSE +0 -0
  11. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/README.md +0 -0
  12. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/__init__.py +0 -0
  13. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/__init__.py +0 -0
  14. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/acl_config.py +0 -0
  15. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/acl_response.py +0 -0
  16. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/auth.py +0 -0
  17. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/common_response.py +0 -0
  18. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/consumer/__init__.py +0 -0
  19. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/consumer/checkpoint_tracker.py +0 -0
  20. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/consumer/config.py +0 -0
  21. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/consumer/consumer_client.py +0 -0
  22. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/consumer/exceptions.py +0 -0
  23. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/consumer/fetched_log_group.py +0 -0
  24. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/consumer/heart_beat.py +0 -0
  25. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/consumer/shard_worker.py +0 -0
  26. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/consumer/tasks.py +0 -0
  27. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/consumer/worker.py +0 -0
  28. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/consumer_group_request.py +0 -0
  29. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/consumer_group_response.py +0 -0
  30. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/credentials.py +0 -0
  31. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/cursor_response.py +0 -0
  32. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/cursor_time_response.py +0 -0
  33. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/es_migration/__init__.py +0 -0
  34. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/es_migration/doc_logitem_converter.py +0 -0
  35. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/es_migration/index_logstore_mappings.py +0 -0
  36. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/es_migration/migration_log.py +0 -0
  37. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/es_migration/migration_manager.py +0 -0
  38. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/es_migration/migration_response.py +0 -0
  39. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/es_migration/util.py +0 -0
  40. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/etl_config_response.py +0 -0
  41. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/etl_core/__init__.py +0 -0
  42. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/etl_core/config_parser.py +0 -0
  43. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/etl_core/etl_util.py +0 -0
  44. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/etl_core/exceptions.py +0 -0
  45. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/etl_core/restrict_config_parser.py +0 -0
  46. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/etl_core/runner.py +0 -0
  47. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/etl_core/settings.py +0 -0
  48. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/etl_core/trans_comp/__init__.py +0 -0
  49. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/etl_core/trans_comp/trans_base.py +0 -0
  50. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/etl_core/trans_comp/trans_csv.py +0 -0
  51. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/etl_core/trans_comp/trans_json.py +0 -0
  52. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/etl_core/trans_comp/trans_kv.py +0 -0
  53. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/etl_core/trans_comp/trans_lookup.py +0 -0
  54. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/etl_core/trans_comp/trans_mv.py +0 -0
  55. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/etl_core/trans_comp/trans_regex.py +0 -0
  56. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/etl_core/trans_comp/trans_set_field.py +0 -0
  57. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/etl_core/transform/__init__.py +0 -0
  58. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/etl_core/transform/condition_list.py +0 -0
  59. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/etl_core/transform/condition_transform.py +0 -0
  60. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/etl_core/transform/condition_util.py +0 -0
  61. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/etl_core/transform/transform_base.py +0 -0
  62. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/etl_core/transform/transform_list.py +0 -0
  63. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/etl_core/transform/transform_meta.py +0 -0
  64. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/ext/__init__.py +0 -0
  65. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/ext/jupyter_magic.py +0 -0
  66. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/ext/syslogclient.py +0 -0
  67. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/external_store_config.py +0 -0
  68. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/external_store_config_response.py +0 -0
  69. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/getcontextlogsresponse.py +0 -0
  70. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/gethistogramsrequest.py +0 -0
  71. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/gethistogramsresponse.py +0 -0
  72. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/getlogsrequest.py +0 -0
  73. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/histogram.py +0 -0
  74. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/index_config_response.py +0 -0
  75. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/ingestion_response.py +0 -0
  76. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/job.py +0 -0
  77. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/listlogstoresrequest.py +0 -0
  78. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/listlogstoresresponse.py +0 -0
  79. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/listtopicsrequest.py +0 -0
  80. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/listtopicsresponse.py +0 -0
  81. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/log_logs_pb2.py +0 -0
  82. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/log_logs_raw_pb2.py +0 -0
  83. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/logclient_core.py +0 -0
  84. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/logclient_operator.py +0 -0
  85. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/logexception.py +0 -0
  86. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/logger_hanlder.py +0 -0
  87. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/logitem.py +0 -0
  88. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/logrequest.py +0 -0
  89. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/logresponse.py +0 -0
  90. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/logstore_config_response.py +0 -0
  91. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/logtail_config_detail.py +0 -0
  92. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/logtail_config_response.py +0 -0
  93. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/machine_group_detail.py +0 -0
  94. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/machinegroup_response.py +0 -0
  95. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/odps_sink.py +0 -0
  96. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/oss_sink.py +0 -0
  97. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/pluralize.py +0 -0
  98. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/project_response.py +0 -0
  99. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/pulllog_response.py +0 -0
  100. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/putlogsrequest.py +0 -0
  101. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/putlogsresponse.py +0 -0
  102. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/queriedlog.py +0 -0
  103. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/resource_params.py +0 -0
  104. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/resource_response.py +0 -0
  105. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/scheduled_sql.py +0 -0
  106. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/scheduled_sql_response.py +0 -0
  107. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/shard_response.py +0 -0
  108. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/shipper_config.py +0 -0
  109. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/shipper_response.py +0 -0
  110. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/sink.py +0 -0
  111. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/sql_instance_response.py +0 -0
  112. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/substore_config_response.py +0 -0
  113. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/tag_response.py +0 -0
  114. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/topostore_params.py +0 -0
  115. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/topostore_response.py +0 -0
  116. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun/log/util.py +0 -0
  117. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun_log_python_sdk.egg-info/SOURCES.txt +0 -0
  118. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun_log_python_sdk.egg-info/dependency_links.txt +0 -0
  119. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun_log_python_sdk.egg-info/requires.txt +0 -0
  120. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/aliyun_log_python_sdk.egg-info/top_level.txt +0 -0
  121. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/setup.cfg +0 -0
  122. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/setup.py +0 -0
  123. {aliyun-log-python-sdk-0.9.5 → aliyun-log-python-sdk-0.9.7}/tests/test_alert.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: aliyun-log-python-sdk
3
- Version: 0.9.5
3
+ Version: 0.9.7
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
@@ -16,13 +16,6 @@ Classifier: Programming Language :: Python :: 3.6
16
16
  Classifier: Programming Language :: Python :: 3.7
17
17
  Classifier: Programming Language :: Python :: Implementation :: PyPy
18
18
  License-File: LICENSE
19
- Requires-Dist: six
20
- Requires-Dist: requests
21
- Requires-Dist: python-dateutil
22
- Requires-Dist: elasticsearch
23
- Requires-Dist: jmespath
24
- Requires-Dist: dateparser
25
- Requires-Dist: protobuf<4.0.0,>3.4.0
26
19
 
27
20
 
28
21
  Python SDK for Alicloud Log Service
@@ -34,6 +34,7 @@ class MappingIndexConverter(object):
34
34
  line_config = IndexLineConfig(token_list=cls.DEFAULT_TOKEN_LIST, chinese=True)
35
35
  key_config_list = cls.to_key_config_list(properties=mapping["properties"])
36
36
  index_config = IndexConfig(line_config=line_config, key_config_list=key_config_list)
37
+ index_config.docvalue_max_text_len = 16384
37
38
  return index_config
38
39
 
39
40
  @classmethod
@@ -43,6 +44,8 @@ class MappingIndexConverter(object):
43
44
  return key_config_list
44
45
  fields = set()
45
46
  for field_name, field_desc in properties.items():
47
+ if len(fields) >= 16:
48
+ break
46
49
  if field_name.lower() in fields:
47
50
  continue
48
51
  fields.add(field_name.lower())
@@ -250,11 +253,12 @@ class MappingIndexConverter(object):
250
253
  key_configs = cls.parse_properties(None, properties)
251
254
  for key_name, key_config in key_configs.items():
252
255
  json_key_config.add_key(key_name=key_name, key_type=key_config.index_type, doc_value=key_config.doc_value)
253
- if len(json_key_config.json_keys) >= 50:
256
+ if len(json_key_config.json_keys) >= 8:
254
257
  break
255
258
  return IndexKeyConfig(
256
259
  index_type=AliyunLogFieldType.JSON,
257
- json_key_config=json_key_config
260
+ json_key_config=json_key_config,
261
+ doc_value=True,
258
262
  )
259
263
 
260
264
  @classmethod
@@ -11,7 +11,7 @@ import json
11
11
  import traceback
12
12
  from datetime import datetime
13
13
  from elasticsearch.exceptions import NotFoundError
14
- from aliyun.log import LogClient
14
+ from aliyun.log import LogClient, LogException
15
15
  from aliyun.log.putlogsrequest import PutLogsRequest
16
16
  from aliyun.log.es_migration.doc_logitem_converter import DocLogItemConverter
17
17
 
@@ -251,12 +251,29 @@ class MigrationLogstore(object):
251
251
  return self._logstore_name
252
252
 
253
253
  def put_logs(self, logitems):
254
- self._log_client.put_logs(
255
- PutLogsRequest(
256
- project=self._project_name,
257
- logstore=self._logstore_name,
258
- topic=self._topic,
259
- source=self._source,
260
- logitems=logitems,
254
+ try:
255
+ self._log_client.put_logs(
256
+ PutLogsRequest(
257
+ project=self._project_name,
258
+ logstore=self._logstore_name,
259
+ topic=self._topic,
260
+ source=self._source,
261
+ logitems=logitems,
262
+ )
263
+ )
264
+ except LogException as exc:
265
+ if exc.get_error_code() != "InvalidLogSize":
266
+ raise
267
+ else: # putting succeeds
268
+ return
269
+
270
+ for item in logitems:
271
+ self._log_client.put_logs(
272
+ PutLogsRequest(
273
+ project=self._project_name,
274
+ logstore=self._logstore_name,
275
+ topic=self._topic,
276
+ source=self._source,
277
+ logitems=[item],
278
+ )
261
279
  )
262
- )
@@ -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
 
@@ -248,20 +248,19 @@ class GetLogsResponse(LogResponse):
248
248
  self._phrase_query_info = GetLogsResponse.PhraseQueryInfo(
249
249
  phrase_query_info) if phrase_query_info else None
250
250
 
251
- # self._limited = meta.get("limited")
252
- # self._processed_bytes = meta.get("processedBytes")
253
- # self._telemetry_type = meta.get("telementryType") # not typo
254
- # self._power_sql = Util.v_or_d(meta.get("powerSql"), False)
255
- # self._inserted_sql = meta.get("insertedSQL")
256
- # self._keys = meta.get("keys")
257
- # self._marker = meta.get("marker")
258
- # self._shard = meta.get("shard")
259
- # self._is_accurate = meta.get("isAccurate")
260
- # self._column_types = meta.get("columnTypes")
261
- # self._highlights = meta.get("highlights")
262
- # self._terms = []
263
- # for term in meta.get("terms", []):
264
- # self._terms.append(GetLogsResponse.Term._from_dict(term))
251
+ self._limited = meta.get("limited")
252
+ self._processed_bytes = meta.get("processedBytes")
253
+ self._telemetry_type = meta.get("telementryType") or meta.get("telemetryType") # not typo
254
+ self._power_sql = Util.v_or_d(meta.get("powerSql"), False)
255
+ self._inserted_sql = meta.get("insertedSQL")
256
+ self._keys = meta.get("keys")
257
+ self._marker = meta.get("marker")
258
+ self._is_accurate = meta.get("isAccurate")
259
+ self._column_types = meta.get("columnTypes")
260
+ self._highlights = meta.get("highlights")
261
+ self._terms = []
262
+ for term in meta.get("terms", []):
263
+ self._terms.append(GetLogsResponse.Term._from_dict(term))
265
264
 
266
265
  def is_completed(self):
267
266
  """ Check if the get logs query is completed
@@ -305,18 +304,17 @@ class GetLogsResponse(LogResponse):
305
304
  'mode': self.get_mode(),
306
305
  'scanBytes': self.get_scan_bytes(),
307
306
  'phraseQueryInfo': phrase_query_info_dict,
308
- # 'limited': self._limited,
309
- # 'processedBytes': self._processed_bytes,
310
- # 'telementryType': self._telemetry_type, # not typo
311
- # 'powerSql': self._power_sql,
312
- # 'insertedSQL': self._inserted_sql,
313
- # 'keys': self._keys,
314
- # 'marker': self._marker,
315
- # 'shard': self._shard,
316
- # 'isAccurate': self._is_accurate,
317
- # 'columnTypes': self._column_types,
318
- # 'highlights': self._highlights,
319
- # 'terms': [term.to_dict() for term in self._terms],
307
+ 'limited': self.get_limited(),
308
+ 'processedBytes': self.get_processed_bytes(),
309
+ 'telementryType': self.get_telemetry_type(), # not typo
310
+ 'powerSql': self.get_power_sql(),
311
+ 'insertedSQL': self.get_inserted_sql(),
312
+ 'keys': self.get_keys(),
313
+ 'marker': self.get_marker(),
314
+ 'isAccurate': self.get_is_accurate(),
315
+ 'columnTypes': self.get_column_types(),
316
+ 'highlights': self.get_highlights(),
317
+ 'terms': [term._to_dict() for term in self.get_terms()],
320
318
  }
321
319
 
322
320
  def log_print(self):
@@ -400,77 +398,72 @@ class GetLogsResponse(LogResponse):
400
398
  """
401
399
  return self._phrase_query_info
402
400
 
403
- # def get_limited(self):
404
- # """
405
- # :return: limited, int
406
- # """
407
- # return self._limited
408
-
409
- # def get_processed_bytes(self):
410
- # """
411
- # :return: processed_bytes, int
412
- # """
413
- # return self._processed_bytes
414
-
415
- # def get_telemetry_type(self):
416
- # """
417
- # :return: telemetry_type, str
418
- # """
419
- # return self._telemetry_type
420
-
421
- # def get_power_sql(self):
422
- # """
423
- # :return: power_sql, bool
424
- # """
425
- # return self._power_sql
426
-
427
- # def get_inserted_sql(self):
428
- # """
429
- # :return: inserted_sql, str
430
- # """
431
- # return self._inserted_sql
432
-
433
- # def get_keys(self):
434
- # """
435
- # :return: keys, List[str]
436
- # """
437
- # return self._keys
438
-
439
- # def get_marker(self):
440
- # """
441
- # :return: marker, str
442
- # """
443
- # return self._marker
444
-
445
- # def get_shard(self):
446
- # """
447
- # :return: shard, int
448
- # """
449
- # return self._shard
450
-
451
- # def get_is_accurate(self):
452
- # """
453
- # :return: is_accurate, bool
454
- # """
455
- # return self._is_accurate
456
-
457
- # def get_column_types(self):
458
- # """
459
- # :return: column_types, List[str]
460
- # """
461
- # return self._column_types
462
-
463
- # def get_highlights(self):
464
- # """
465
- # :return: highlights, List[Dict]
466
- # """
467
- # return self._highlights
401
+ def get_limited(self):
402
+ """
403
+ :return: limited, int
404
+ """
405
+ return self._limited
406
+
407
+ def get_processed_bytes(self):
408
+ """
409
+ :return: processed_bytes, int
410
+ """
411
+ return self._processed_bytes
412
+
413
+ def get_telemetry_type(self):
414
+ """
415
+ :return: telemetry_type, str
416
+ """
417
+ return self._telemetry_type
418
+
419
+ def get_power_sql(self):
420
+ """
421
+ :return: power_sql, bool
422
+ """
423
+ return self._power_sql
424
+
425
+ def get_inserted_sql(self):
426
+ """
427
+ :return: inserted_sql, str
428
+ """
429
+ return self._inserted_sql
430
+
431
+ def get_keys(self):
432
+ """
433
+ :return: keys, List[str]
434
+ """
435
+ return self._keys
436
+
437
+ def get_marker(self):
438
+ """
439
+ :return: marker, str
440
+ """
441
+ return self._marker
442
+
443
+
444
+ def get_is_accurate(self):
445
+ """
446
+ :return: is_accurate, bool
447
+ """
448
+ return self._is_accurate
449
+
450
+ def get_column_types(self):
451
+ """
452
+ :return: column_types, List[str]
453
+ """
454
+ return self._column_types
455
+
456
+ def get_highlights(self):
457
+ """
458
+ :return: highlights, List[Dict]
459
+ """
460
+ return self._highlights
468
461
 
469
- # def get_terms(self):
470
- # """
471
- # :return: terms, List[Term]
472
- # """
473
- # return self._terms
462
+ def get_terms(self):
463
+ """
464
+ :return: terms, List[Term]
465
+ """
466
+ return self._terms
474
467
 
475
468
  class PhraseQueryInfo():
476
469
  """ query info of phrase, includes beginOffset/endOffset/scanAll/endTime
@@ -528,41 +521,41 @@ class GetLogsResponse(LogResponse):
528
521
  print(self._to_dict())
529
522
 
530
523
 
531
- # class Term():
532
- # """ terms of query, field key/term
533
- # """
534
-
535
- # def __init__(self, key, term):
536
- # self._key = key
537
- # self._term = term
538
-
539
- # @classmethod
540
- # def _from_dict(cls, data):
541
- # """ Initialize from a dict
542
- # """
543
- # key = data.get("key")
544
- # term = data.get("term")
545
- # return cls(key, term)
546
-
547
- # def get_key(self):
548
- # """ field key of term
549
- # """
550
- # return self._key
551
-
552
- # def get_term(self):
553
- # """ field term of term
554
- # """
555
- # return self._term
556
-
557
- # def _to_dict(self):
558
- # """ to Dict
559
- # """
560
- # return {
561
- # "key": self._key,
562
- # "term": self._term
563
- # }
564
-
565
- # def log_print(self):
566
- # """ print info
567
- # """
568
- # print(self._to_dict())
524
+ class Term():
525
+ """ terms of query, field key/term
526
+ """
527
+
528
+ def __init__(self, key, term):
529
+ self._key = key
530
+ self._term = term
531
+
532
+ @classmethod
533
+ def _from_dict(cls, data):
534
+ """ Initialize from a dict
535
+ """
536
+ key = data.get("key")
537
+ term = data.get("term")
538
+ return cls(key, term)
539
+
540
+ def get_key(self):
541
+ """ field key of term
542
+ """
543
+ return self._key
544
+
545
+ def get_term(self):
546
+ """ field term of term
547
+ """
548
+ return self._term
549
+
550
+ def _to_dict(self):
551
+ """ to Dict
552
+ """
553
+ return {
554
+ "key": self.get_key(),
555
+ "term": self.get_term()
556
+ }
557
+
558
+ def log_print(self):
559
+ """ print info
560
+ """
561
+ print(self._to_dict())
@@ -25,6 +25,7 @@ class IndexJsonKeyConfig(object):
25
25
  self.max_depth = max_depth
26
26
  self.alias = alias
27
27
  self.json_keys = {}
28
+ self.keys_set = set()
28
29
 
29
30
  """
30
31
  Inner key config in json, if the json value is :
@@ -52,6 +53,10 @@ class IndexJsonKeyConfig(object):
52
53
  def add_key(self, key_name, key_type, doc_value=False, alias=None):
53
54
  if key_type != 'text' and key_type != 'long' and key_type != 'double':
54
55
  return
56
+ if key_name.lower() in self.keys_set:
57
+ return
58
+ self.keys_set.add(key_name.lower())
59
+
55
60
  self.json_keys[key_name] = {}
56
61
  self.json_keys[key_name]["type"] = key_type
57
62
  self.json_keys[key_name]["doc_value"] = doc_value
@@ -5075,7 +5075,7 @@ class LogClient(object):
5075
5075
  :type project_name: string
5076
5076
  :param project_name: the Project name
5077
5077
 
5078
- :type export: string
5078
+ :type export: Export
5079
5079
  :param export: the export job configuration
5080
5080
  """
5081
5081
  params = {}
@@ -5110,6 +5110,28 @@ class LogClient(object):
5110
5110
  (resp, header) = self._send("DELETE", project_name, None, resource, params, headers)
5111
5111
  return DeleteExportResponse(header, resp)
5112
5112
 
5113
+ def update_export(self, project_name, job_name, export):
5114
+ """ Update and Restart an export job
5115
+ Unsuccessful opertaion will cause an LogException.
5116
+
5117
+ :type project_name: string
5118
+ :param project_name: the Project name
5119
+
5120
+ :type job_name: string
5121
+ :param job_name: the job name of export job
5122
+
5123
+ :type export: string
5124
+ :param export: the export job configuration
5125
+ """
5126
+ if not isinstance(export, str):
5127
+ raise TypeError("export type must be string")
5128
+ params = {"action": "RESTART"}
5129
+ body = six.b(export)
5130
+ headers = {'Content-Type': 'application/json', 'x-log-bodyrawsize': str(len(body))}
5131
+ resource = "/jobs/" + job_name
5132
+ (resp, header) = self._send("PUT", project_name, body, resource, params, headers)
5133
+ return UpdateExportResponse(header, resp)
5134
+
5113
5135
  def get_export(self, project_name, job_name):
5114
5136
  """ get export
5115
5137
  Unsuccessful operation will cause an LogException.
@@ -1,4 +1,4 @@
1
- __version__ = '0.9.5'
1
+ __version__ = '0.9.7'
2
2
 
3
3
  import sys
4
4
  OS_VERSION = str(sys.platform)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: aliyun-log-python-sdk
3
- Version: 0.9.5
3
+ Version: 0.9.7
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
@@ -16,13 +16,6 @@ Classifier: Programming Language :: Python :: 3.6
16
16
  Classifier: Programming Language :: Python :: 3.7
17
17
  Classifier: Programming Language :: Python :: Implementation :: PyPy
18
18
  License-File: LICENSE
19
- Requires-Dist: six
20
- Requires-Dist: requests
21
- Requires-Dist: python-dateutil
22
- Requires-Dist: elasticsearch
23
- Requires-Dist: jmespath
24
- Requires-Dist: dateparser
25
- Requires-Dist: protobuf<4.0.0,>3.4.0
26
19
 
27
20
 
28
21
  Python SDK for Alicloud Log Service