Skip to content

Commit e5fc39b

Browse files
Add more pruning for hyperflex and logging for large records
1 parent 80a3096 commit e5fc39b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

input_module_intersight.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ def pop(pop, data):
108108
return data
109109

110110
def write_splunk(index, source, sourcetype, data):
111+
length = len(json.dumps(data))
112+
if length > 9999:
113+
helper.log_warning(
114+
f"{s} | Record for {sourcetype} exceeds 10k limit! Length={length} Moid={data['Moid']}")
111115
event = helper.new_event(
112116
source=source, index=index, sourcetype=sourcetype, data=json.dumps(data))
113117
ew.write_event(event)
@@ -472,7 +476,7 @@ def write_splunk(index, source, sourcetype, data):
472476
f"{endpoint}?$expand=Encryption($select=State),License,RegisteredDevice($select=ClaimedByUserName,ClaimedTime,ConnectionStatusLastChangeTime,ConnectionStatus,CreateTime,ReadOnly)&$top={results_per_page}&$skip={str(i)}")
473477
for data in RESPONSE.json()['Results']:
474478
data = pop(['Alarm', 'Ancestors', 'ChildClusters', 'Owners', 'PermissionResources',
475-
'StorageContainers', 'Nodes', 'Health', 'ParentCluster'], data)
479+
'StorageContainers', 'Nodes', 'Health', 'ParentCluster', 'Volumes'], data)
476480
data['License'] = pop(
477481
['Ancestors', 'Cluster', 'Owners', 'PermissionResources', 'RegisteredDevice'], data['License'])
478482
data['RegisteredDevice'] = pop(
@@ -509,7 +513,7 @@ def write_splunk(index, source, sourcetype, data):
509513
else:
510514
for i in range(0, len(data['Drives'])):
511515
data['Drives'][i] = pop(
512-
['Ancestors', 'LocatorLed', 'Node', 'Owners', 'Parent', 'PermissionResources'], data['Drives'][i])
516+
['AccountMoid', 'Ancestors', 'ClassId', 'NodeUuid', 'Uuid', 'SharedScope', 'ObjectType', 'Moid', 'HostName', 'Tags', 'DomainGroupMoid', 'LocatorLed', 'Node', 'Owners', 'Parent', 'PermissionResources'], data['Drives'][i])
513517
write_splunk(index, account_name,
514518
'cisco:intersight:hyperflexNodes', data)
515519

0 commit comments

Comments
 (0)