var url = "//www.inmon.com/tutorials2/customers_cidr.xml"; // get customer data var customersString = readurl(url); var customers = new XML(customersString); // get cidrs for customerid var cidrs = new Array(); for each(var cidr in customers.customer.(@id == customerid)..cidr) { cidrs.push(cidr.@address + "/" + cidr.@bits); } if(cidrs.length > 0) { var where = "(ipsource=" + cidrs + "|" + "ipdestination=" + cidrs + ")"; where += "&(ipsource=" + target + "|" + "ipdestination=" + target + ")"; println(where); var query = Query.topN( "historytrmx", "sourceaddress,sourceport,destinationaddress,destinationport,bytes", where, "today", "bytes", 100); var t = query.run(); t.printHTML(true); }