Hi,
I have been using following siddhi query to get the events count per minute;  
ts as timestamp (string) and ftp_requests as count (int)

from FTPInStream[command == 'USER']
select time:timestampInMilliseconds(time:dateAdd(str:replaceAll(ts,'T',' '), 5, 
'hour',"yyyy-MM-dd HH:mm:ss"),'yyyy-MM-dd HH:mm') as milliseconds , uid, 
id_orig_h, id_orig_p, id_resp_h, id_resp_p
insert into intermediateStream;

from intermediateStream#window.externalTimeBatch( milliseconds ,1 min, 
milliseconds, 1 min)
select time:dateFormat(milliseconds, 'yyyy-MM-dd HH:mm' ) as ts , 
cast(count(milliseconds), 'int') as ftp_requests
group by milliseconds
insert into FTPOutStream; There is a need to populate ftp_requests parameter of 
FTPOutStream as accumulative i.e. (each new no of requests is addition of 
itself and previously added to stream). To achieve this I changed the query as 
below:
from FTPInStream[command == 'USER']
select time:timestampInMilliseconds(time:dateAdd(str:replaceAll(ts,'T',' '), 5, 
'hour',"yyyy-MM-dd HH:mm:ss"),'yyyy-MM-dd HH:mm') as milliseconds , uid, 
id_orig_h, id_orig_p, id_resp_h, id_resp_p
insert into intermediateStream;

from intermediateStream
select milliseconds, cast(count(milliseconds), 'int') as ftp_request
group by milliseconds
insert into intermediateStream111;

from intermediateStream111#window.externalTimeBatch( milliseconds ,1 min, 
milliseconds, 1 min)
select time:dateFormat(milliseconds, 'yyyy-MM-dd HH:mm' ) as ts , 
cast(sum(ftp_request), 'int') as ftp_requests
insert into FTPOutStream;

But I am getting nothing in ftp_requests parameter.
Any suggestions?
Regards, Aneela Safdar
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to