-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #71 from Dynatrace-James-Kitson/log-exporting
add v2 log exporting
- Loading branch information
Showing
4 changed files
with
77 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"results": [{"timestamp": 1683574915193, "content": "Failed to assign monitoring configuration to ActiveGate. Reason: Error testing endpoint https://192.168.222.10/: HTTPSConnectionPool(host='192.168.222.10', port=443): Max retries exceeded with url: /api/cluster?fields=uuid%2Cname%2Clocation%2Cversion%2Cstatistics (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000002A3FBFBCDC0>, 'Connection to 192.168.222.10 timed out. (connect timeout=None)'))", "status": "ERROR", "eventType": "SFM", "additionalColumns": {"loglevel": ["ERROR"], "dt.active_gate.group.name": ["default"], "dt.extension.ds": ["python"], "dt.extension.name": ["custom:extension-netapp-ontap"], "log.source": ["dsfm"], "dt.event.key": ["extension.status"], "dt.extension.config.id": ["c89d11aa-7637-34a3-94cb-bcc07f88c1f0"], "dt.extension.status": ["CUSTOM_ERROR"]}}, {"timestamp": 1683574855122, "content": "Failed to assign monitoring configuration to ActiveGate. Reason: Error testing endpoint https://192.168.222.10/: HTTPSConnectionPool(host='192.168.222.10', port=443): Max retries exceeded with url: /api/cluster?fields=uuid%2Cname%2Clocation%2Cversion%2Cstatistics (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000001AFE338CDC0>, 'Connection to 192.168.222.10 timed out. (connect timeout=None)'))", "status": "ERROR", "eventType": "SFM", "additionalColumns": {"loglevel": ["ERROR"], "dt.active_gate.group.name": ["default"], "dt.extension.ds": ["python"], "dt.extension.name": ["custom:extension-netapp-ontap"], "log.source": ["dsfm"], "dt.event.key": ["extension.status"], "dt.extension.config.id": ["c89d11aa-7637-34a3-94cb-bcc07f88c1f0"], "dt.extension.status": ["CUSTOM_ERROR"]}}, {"timestamp": 1683574795002, "content": "Failed to assign monitoring configuration to ActiveGate. Reason: Error testing endpoint https://192.168.222.10/: HTTPSConnectionPool(host='192.168.222.10', port=443): Max retries exceeded with url: /api/cluster?fields=uuid%2Cname%2Clocation%2Cversion%2Cstatistics (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000001D1EC4CCDC0>, 'Connection to 192.168.222.10 timed out. (connect timeout=None)'))", "status": "ERROR", "eventType": "SFM", "additionalColumns": {"loglevel": ["ERROR"], "dt.active_gate.group.name": ["default"], "dt.extension.ds": ["python"], "dt.extension.name": ["custom:extension-netapp-ontap"], "log.source": ["dsfm"], "dt.event.key": ["extension.status"], "dt.extension.config.id": ["c89d11aa-7637-34a3-94cb-bcc07f88c1f0"], "dt.extension.status": ["CUSTOM_ERROR"]}}, {"timestamp": 1683574764953, "content": "Failed to assign monitoring configuration to ActiveGate. Reason: Cannot extract extension from C:\\ProgramData\\dynatrace\\remotepluginmodule\\/agent/runtime\\extensions\\download\\custom_sybase-ase-health-ci: checking signature failed", "status": "ERROR", "eventType": "SFM", "additionalColumns": {"loglevel": ["ERROR"], "dt.active_gate.group.name": ["default"], "dt.extension.ds": ["python"], "dt.extension.name": ["custom:sybase-ase-health-ci"], "log.source": ["dsfm"], "dt.event.key": ["extension.status"], "dt.extension.config.id": ["64132242-27f9-39b7-a456-2b7c3bc359db"], "dt.extension.status": ["CUSTOM_ERROR"]}}, {"timestamp": 1683574734903, "content": "Failed to assign monitoring configuration to ActiveGate. Reason: Error testing endpoint https://192.168.222.10/: HTTPSConnectionPool(host='192.168.222.10', port=443): Max retries exceeded with url: /api/cluster?fields=uuid%2Cname%2Clocation%2Cversion%2Cstatistics (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000002646D46CDC0>, 'Connection to 192.168.222.10 timed out. (connect timeout=None)'))", "status": "ERROR", "eventType": "SFM", "additionalColumns": {"loglevel": ["ERROR"], "dt.active_gate.group.name": ["default"], "dt.extension.ds": ["python"], "dt.extension.name": ["custom:extension-netapp-ontap"], "log.source": ["dsfm"], "dt.event.key": ["extension.status"], "dt.extension.config.id": ["c89d11aa-7637-34a3-94cb-bcc07f88c1f0"], "dt.extension.status": ["CUSTOM_ERROR"]}}, {"timestamp": 1683574704874, "content": "Failed to assign monitoring configuration to ActiveGate. Reason: Extension custom:sybase-ase-health-ci(0.0.6) not available in cache yet (queued for download)", "status": "ERROR", "eventType": "SFM", "additionalColumns": {"loglevel": ["ERROR"], "dt.active_gate.group.name": ["default"], "dt.extension.ds": ["python"], "dt.extension.name": ["custom:sybase-ase-health-ci"], "log.source": ["dsfm"], "dt.event.key": ["extension.status"], "dt.extension.config.id": ["64132242-27f9-39b7-a456-2b7c3bc359db"], "dt.extension.status": ["CUSTOM_ERROR"]}}, {"timestamp": 1683574674822, "content": "Failed to assign monitoring configuration to ActiveGate. Reason: Error testing endpoint https://192.168.222.10/: HTTPSConnectionPool(host='192.168.222.10', port=443): Max retries exceeded with url: /api/cluster?fields=uuid%2Cname%2Clocation%2Cversion%2Cstatistics (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x0000029846F9CDC0>, 'Connection to 192.168.222.10 timed out. (connect timeout=None)'))", "status": "ERROR", "eventType": "SFM", "additionalColumns": {"loglevel": ["ERROR"], "dt.active_gate.group.name": ["default"], "dt.extension.ds": ["python"], "dt.extension.name": ["custom:extension-netapp-ontap"], "log.source": ["dsfm"], "dt.event.key": ["extension.status"], "dt.extension.config.id": ["c89d11aa-7637-34a3-94cb-bcc07f88c1f0"], "dt.extension.status": ["CUSTOM_ERROR"]}}, {"timestamp": 1683574614732, "content": "Failed to assign monitoring configuration to ActiveGate. Reason: Error testing endpoint https://192.168.222.10/: HTTPSConnectionPool(host='192.168.222.10', port=443): Max retries exceeded with url: /api/cluster?fields=uuid%2Cname%2Clocation%2Cversion%2Cstatistics (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x00000209E87FCDC0>, 'Connection to 192.168.222.10 timed out. (connect timeout=None)'))", "status": "ERROR", "eventType": "SFM", "additionalColumns": {"loglevel": ["ERROR"], "dt.active_gate.group.name": ["default"], "dt.extension.ds": ["python"], "dt.extension.name": ["custom:extension-netapp-ontap"], "log.source": ["dsfm"], "dt.event.key": ["extension.status"], "dt.extension.config.id": ["c89d11aa-7637-34a3-94cb-bcc07f88c1f0"], "dt.extension.status": ["CUSTOM_ERROR"]}}, {"timestamp": 1683574554719, "content": "Failed to assign monitoring configuration to ActiveGate. Reason: Error testing endpoint https://192.168.222.10/: HTTPSConnectionPool(host='192.168.222.10', port=443): Max retries exceeded with url: /api/cluster?fields=uuid%2Cname%2Clocation%2Cversion%2Cstatistics (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000001EDA798CDC0>, 'Connection to 192.168.222.10 timed out. (connect timeout=None)'))", "status": "ERROR", "eventType": "SFM", "additionalColumns": {"loglevel": ["ERROR"], "dt.active_gate.group.name": ["default"], "dt.extension.ds": ["python"], "dt.extension.name": ["custom:extension-netapp-ontap"], "log.source": ["dsfm"], "dt.event.key": ["extension.status"], "dt.extension.config.id": ["c89d11aa-7637-34a3-94cb-bcc07f88c1f0"], "dt.extension.status": ["CUSTOM_ERROR"]}}, {"timestamp": 1683574494522, "content": "Failed to assign monitoring configuration to ActiveGate. Reason: Error testing endpoint https://192.168.222.10/: HTTPSConnectionPool(host='192.168.222.10', port=443): Max retries exceeded with url: /api/cluster?fields=uuid%2Cname%2Clocation%2Cversion%2Cstatistics (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x00000215FC46CDC0>, 'Connection to 192.168.222.10 timed out. (connect timeout=None)'))", "status": "ERROR", "eventType": "SFM", "additionalColumns": {"loglevel": ["ERROR"], "dt.active_gate.group.name": ["default"], "dt.extension.ds": ["python"], "dt.extension.name": ["custom:extension-netapp-ontap"], "log.source": ["dsfm"], "dt.event.key": ["extension.status"], "dt.extension.config.id": ["c89d11aa-7637-34a3-94cb-bcc07f88c1f0"], "dt.extension.status": ["CUSTOM_ERROR"]}}, {"timestamp": 1683574459170, "content": "OK", "status": "INFO", "eventType": "SFM", "additionalColumns": {"loglevel": ["INFO"], "dt.active_gate.group.name": ["default"], "dt.extension.ds": ["python"], "dt.active_gate.id": ["0x16f6e00b"], "dt.extension.name": ["custom:vcenter-extension"], "log.source": ["dsfm"], "dt.event.key": ["extension.status"], "host.name": ["TAG009444368559"], "dt.extension.config.id": ["834f045c-02d3-31b7-91f8-8bfb3f6c050e"], "dt.extension.status": ["OK"]}}, {"timestamp": 1683574434460, "content": "Failed to assign monitoring configuration to ActiveGate. Reason: Error testing endpoint https://192.168.222.10/: HTTPSConnectionPool(host='192.168.222.10', port=443): Max retries exceeded with url: /api/cluster?fields=uuid%2Cname%2Clocation%2Cversion%2Cstatistics (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000001AD6AEDCDC0>, 'Connection to 192.168.222.10 timed out. (connect timeout=None)'))", "status": "ERROR", "eventType": "SFM", "additionalColumns": {"loglevel": ["ERROR"], "dt.active_gate.group.name": ["default"], "dt.extension.ds": ["python"], "dt.extension.name": ["custom:extension-netapp-ontap"], "log.source": ["dsfm"], "dt.event.key": ["extension.status"], "dt.extension.config.id": ["c89d11aa-7637-34a3-94cb-bcc07f88c1f0"], "dt.extension.status": ["CUSTOM_ERROR"]}}, {"timestamp": 1683574409411, "content": "Failed to assign monitoring configuration to ActiveGate. Reason: Fast check failed for 1 endpoint(s). Cannot connect to database localhost:0. Exception occured: Socket fail to connect to host:address=(host=localhost)(port=3306)(type=primary). Connection refused: connect. ", "status": "ERROR", "eventType": "SFM", "additionalColumns": {"loglevel": ["ERROR"], "dt.active_gate.group.name": ["default"], "dt.extension.ds": ["sqlMySql"], "dt.extension.name": ["com.dynatrace.extension.mysql"], "log.source": ["dsfm"], "dt.event.key": ["extension.status"], "dt.extension.config.id": ["7fb25156-5681-3f94-8f01-41a46f3d8935"], "dt.extension.status": ["CUSTOM_ERROR"]}}, {"timestamp": 1683574405008, "content": "Failed to assign monitoring configuration to ActiveGate. Reason: Cannot extract extension from C:\\ProgramData\\dynatrace\\remotepluginmodule\\/agent/runtime\\extensions\\download\\custom_sybase-ase-health-ci: checking signature failed", "status": "ERROR", "eventType": "SFM", "additionalColumns": {"loglevel": ["ERROR"], "dt.active_gate.group.name": ["default"], "dt.extension.ds": ["python"], "dt.extension.name": ["custom:sybase-ase-health-ci"], "log.source": ["dsfm"], "dt.event.key": ["extension.status"], "dt.extension.config.id": ["64132242-27f9-39b7-a456-2b7c3bc359db"], "dt.extension.status": ["CUSTOM_ERROR"]}}, {"timestamp": 1683574399171, "content": "Method=query_vsphere: Callback Method=query_vsphere took 69.6077 seconds to execute, which is longer than the interval of 60.0s", "status": "ERROR", "eventType": "SFM", "additionalColumns": {"loglevel": ["ERROR"], "dt.active_gate.group.name": ["default"], "dt.extension.ds": ["python"], "dt.active_gate.id": ["0x16f6e00b"], "dt.extension.name": ["custom:vcenter-extension"], "log.source": ["dsfm"], "dt.event.key": ["extension.status"], "host.name": ["TAG009444368559"], "dt.extension.config.id": ["834f045c-02d3-31b7-91f8-8bfb3f6c050e"], "dt.extension.status": ["GENERIC_ERROR"]}}, {"timestamp": 1683574397440, "content": "Failed to assign monitoring configuration to ActiveGate. Reason: The monitoring configuration requires ActiveGate version 1.256.0 or later that supports data source python (runtime version min: 3.9.0) and belongs to group \"windows\"", "status": "ERROR", "eventType": "SFM", "additionalColumns": {"loglevel": ["ERROR"], "dt.active_gate.group.name": ["windows"], "dt.extension.ds": ["python"], "dt.extension.name": ["custom:vlocity-query"], "log.source": ["dsfm"], "dt.event.key": ["extension.status"], "dt.extension.config.id": ["7f3d5e87-0a6c-33db-8e4a-6b137f7d1114"], "dt.extension.status": ["NO_SUITABLE_ACTIVE_MONITOR"]}}, {"timestamp": 1683574397440, "content": "Failed to assign monitoring configuration to ActiveGate. Reason: The monitoring configuration requires ActiveGate version 1.259.0 or later that supports data source python (runtime version min: 3.9.0) and belongs to group \"windows\"", "status": "ERROR", "eventType": "SFM", "additionalColumns": {"loglevel": ["ERROR"], "dt.active_gate.group.name": ["windows"], "dt.extension.ds": ["python"], "dt.extension.name": ["custom:lloyds-status-page-extension"], "log.source": ["dsfm"], "dt.event.key": ["extension.status"], "dt.extension.config.id": ["b1f1e72e-1b0e-3d98-aac6-5bae991eb425"], "dt.extension.status": ["NO_SUITABLE_ACTIVE_MONITOR"]}}, {"timestamp": 1683574397439, "content": "Failed to assign monitoring configuration to ActiveGate. Reason: The monitoring configuration requires ActiveGate version 1.256.0 or later that supports data source python (runtime version min: 3.9.0) and belongs to group \"windows\"", "status": "ERROR", "eventType": "SFM", "additionalColumns": {"loglevel": ["ERROR"], "dt.active_gate.group.name": ["windows"], "dt.extension.ds": ["python"], "dt.extension.name": ["custom:remote-unix"], "log.source": ["dsfm"], "dt.event.key": ["extension.status"], "dt.extension.config.id": ["f1d59951-5fa2-35bf-9ead-1117e4e31981"], "dt.extension.status": ["NO_SUITABLE_ACTIVE_MONITOR"]}}], "pageSize": 18, "totalCount": 18} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from dynatrace import Dynatrace | ||
from datetime import datetime | ||
|
||
from dynatrace.environment_v2.logs import LogRecord, EventType, LogRecordStatus | ||
from dynatrace.pagination import PaginatedList | ||
|
||
|
||
def test_export(dt: Dynatrace): | ||
logs = dt.logs.export(time_from="now-10m") | ||
assert isinstance(logs, PaginatedList) | ||
|
||
logs = list(logs) | ||
assert len(logs) == 18 | ||
|
||
first = logs[0] | ||
assert isinstance(first, LogRecord) | ||
assert first.additional_columns['dt.extension.ds'][0] == "python" | ||
assert first.content.startswith("Failed to assign") | ||
assert first.event_type == EventType.SFM | ||
assert first.status == LogRecordStatus.ERROR | ||
assert first.timestamp == datetime.utcfromtimestamp(1683574915193 / 1000) | ||
|