Please don't drop the group, I think the discussion will be of use to others.
Answers to your questions inline.
Thanks a lot for your prompt response and this is a good starting point for me. I also have a few more points in mind for your advise1/ I am also looking for a way to to define the pps/bps threshold per group level and this is essential for ISP that provide ddos protect to the downstream customers. Please kindly give me some help.
2/ I am also looking for a way to replace our current network analyzer with faster time analysis and I think sflow-rt can be used to achieve this. I am sending the flow via syslog to Logstash for processing and then parse to Elasticsearch. The flow data are needed to have some necessary fields such as src ip, dst ip, src asn, dst asn..etc and also metric field such as bps and pps. I did not see any pps or bps flowkeys for each flow record so are those the calculated flowkeys? Please kindly share me some clue to get pps and bps metric. Here is my script to send flow to Logstash for your review.
var server = '172.16.60.39';
var port = 5514;
var facility = 16; // local0
var severity = 5; // notice
var flowkeys = [
'ipsource',
'ipdestination',
'country:ipsource',
'country:ipdestination',
'asn:ipsource',
'asn:ipdestination',
'bytes',
'frames',
'agent',
'direction',
'inputifindex',
'outputifindex',
'macsource',
'macdestination',
'null:vlansource:unknown',
'null:vlandestination:unknown',
'null:ethernetprotocol:unknown',
'null:ipprotocol:unknown',
'null:tcpsourceport:unknown',
'null:tcpdestinationport:unknown',
'null:udpsourceport:unknown',
'null:udpdestinationport:unknown']
setFlow('uport', {
keys: flowkeys,
value:'frames',
log:true,
flowStart:true
});
setFlowHandler(function(rec) {
var keys = rec.flowKeys.split(',');
var msg = {};
for(var i = 0; i < flowkeys.length; i++) msg[flowkeys[i]] = keys[i];
syslog(server,port,facility,severity,msg);
},['uport']);
You can add the flow value to the syslog message :
msg.value = rec.value;
The flowStart:true flag means that the flow will be generated with the first packet of the flow, so the value for frames reported in the flow will always be 1 * sampling_rate. Leave out the argument, or set to false for more traditional flows. Set the activeTimeout to specify how often you want to wait before a flow record is generated. You can set values:['bytes'] in your setFlow() definition so that you have both byte and packet counts in the flow records.
Logging flow records to Elasticsearch is going to delay metrics. You might want to try the Browse Flows app (
https://github.com/sflow-rt/browse-flows) for real-time troubleshooting and then the Prometheus app (
https://github.com/sflow-rt/prometheus) for near real-time dashboards. Browse Flows is a good way to experiment and find useful flow definitions before creating a Prometheus flow metric.