In my previous question I didn't think a join would work, but somesoni2, proved that it would work. The only problem was it didn't scale.
search netactivity | stats count by source, destination, protocol, destinationport
2. | join type=left source, destination, protocol, destinationport
3. [ | inputlookup allowedrules | eval Port=split(Port,"-")
4. | eval s=tonumber(mvindex(Port,0))| eval e=tonumber(mvindex(Port,1))
5. | eval destinationport=mvrange(s,e+1,1) | mvexpand destinationport
6. | table Source Destination Protocol destinationport ApprovedBy
7. | rename Source as source Destination as destination Protocol as protocol ]
As the allowedrules table was being updated, we found the need to have a number of entries between distinct sources and destinations for high ports (49152-65535) over 16,000 ports per source/destination combination. Quickly we found that the mvrange and mvexpand option above, grew the allowedrules table too large to be effective (actually, there must be a limit to an inputlookup or our limits.conf needed to be re-configured because we would find that the table would not grow larger that 12,000 entries. So I am back trying to come up with a better option.
I have tried a map search looking for the source, destination and protocol, then parsing the Port (if it contains a "-") to then compare the port (if startport <= Port AND endport >= Port).
for some reason
search netactivity | stats count by source, destination, protocol, destinationport | map search="| inputlookup allowedrules | search Src=$source$ Dest=$destination$ Proto=$protocol$ | eval Destport=$destinationport$ | table Src, Dest, Proto, Destport"
pulls all the allowedrules for the source/destination/protocol combination, but as soon as I add the logic to test if the destinationport falls within the port range, no matches are found:
search netactivity | stats count by source, destination, protocol, destinationport | map search="| inputlookup allowedrules | search Src=$source$ Dest=$destination$ Proto=$protocol$ | eval Destport=$destinationport$ | eval tmpPort=split(Port,"-") | eval startport=tonumber(mvindex(tmpPort,0)) | eval endport=if(mvcount(tmpPort)>0,tonumber(mvindex(tmpPort,1)), startport) | search startport<=Destport AND endport>=Destport | eval Status=if(isnotNull(ApproveBy), ApproveBy, "Not Approved") | table Src, Dest, Proto, Destport, Status"
Thanks in advance for any help.
Jason
... View more