we are trying to use the code block to return the computer name of a log entry in the data stream OTHER. Executing the commands in a python shell (with inward_array filled with dummy data) works. We however get an exception in DNIF (name ‘int’ is not defined). (we cast to int, since we otherwise receive an error ‘string indices must be integers’ for the slice function (computer_name[start_index,end_index]))
for log in inward_array:
computer_name = log[’$ComputerName’]
start_index = int(computer_name.find(’“computer_name”:"’) + len(’“computer_name”:"’))
end_index = int(computer_name.find(’.DOMAIN.NAME’, start_index) + len(’.DOMAIN.NAME’))
log[’$ComputerName’] = computer_name[start_index,end_index]
Is there a way we can get this to work in DNIF?