I have a lookup table from which I need to read the IP addresses one by one, perform calculations on each address, and then place the results in a new field.
Here is my query that performs calculations on the input IP address.
"IP-Address" NOT Audit NOT "%BGP_SESSION-5-ADJCHANGE" NOT "%BGP-3-NOTIFICATION" NOT "%BGP-5-NBR_RESET" NOT passive NOT "%BGP-3-BGP_NO_REMOTE_READ" AND "%BGP-5-ADJCHANGE: neighbor"
| rex "%BGP-5-ADJCHANGE: neighbor (?P<Interface_Name>(.+)),"
| transaction host startswith="Down" endswith="Up" keepevicted=true
| eval duration=if(duration==0,now()-_time,duration)
| convert rmunit(duration) as numSecs
| stats sum(numSecs) as Downtime_Duration
| eval Uptime_duration = 2592000 - Downtime_Duration
| eval Availability_Percentage = Uptime_duration / 2592000
| eval string_Downdur = tostring(round(Downtime_Duration), "duration")
| eval string_Updur = tostring(round(Uptime_duration), "duration")
| eval formatted_Downdur = replace(string_Downdur,"(?:(\d+)\+)?0?(\d+):0?(\d+):0?(\d+)","\1d \2h \3m \4s")
| eval formatted_Updur = replace(string_Updur,"(?:(\d+)\+)?0?(\d+):0?(\d+):0?(\d+)","\1d \2h \3m \4s")
| eval stringDownSecs = replace(formatted_Downdur, "^d (0h (0m )?)?","")
| eval stringUpSecs = replace(formatted_Updur, "^d (0h (0m )?)?","")
| table host, Interface_Name, _time, stringDownSecs, stringUpSecs, Availability_Percentage
| rename _time AS "Interface Down", host AS "Reporting Host", stringDownSecs AS "Total Downtime", stringUpSecs AS "Total Uptime"
Also, this is a query that shows how to read the lookup table. | inputlookup LinkTunnelMap | table TunnelIP
The question is: how can I retrieve the IP addresses from this lookup table one by one, perform calculations on each address, and store the results in a new field like a for-loop process?
... View more