2016-02-12 11:26 AM
Once you start writing more complex ESA rules, it is useful to be able to see what values are being stored in named windows. Lee Kirkpatrick posted the following recently which will hopefully help a few people out.
All the following is done on an ESA.
Run the following command to open the esa-client:
When run, the following prompt will be displayed:
How many and what values exist in my window(s)?
Let’s say, for example, I created the following window in EPL:
CREATE WINDOW ActiveUsers.win:time(1 hour) (user_dst string);
INSERT INTO ActiveUsers
SELECT user_dst FROM Event(user_dst IS NOT NULL);
And wanted to know how many values are stored in the window, I can perform the following from the esa-client:
jmx-cd /CEP/Engine/windows
localhost:com.rsa.netwitness.esa:/CEP/Engine/windows>jmx-invoke getWindowSize --param ActiveUsers
2
If I wanted to see what these 2 values were, I could run the following:
localhost:com.rsa.netwitness.esa:/CEP/Engine/windows>jmx-invoke query --param "SELECT * FROM ActiveUsers"
[{
"ActiveUsers": {
"user_dst": "root"
}
}
, {
"ActiveUsers": {
"user_dst": "root"
}
}
]
2016-04-19 09:59 AM
Note this does not work in 10.6
2016-04-20 04:13 AM
Hello David,
At the last week I met Nikolay Klender an he showed me some interesting ESA rule. I would like optimize it but my aircraft wait me for boarding to travel to warm country. 🙂
Could you look on rules below and maybe you have any ideas how those can use more usefull?
Nikolay Klender invented very useful behavior rules like:
- If volume of event abnormal increase a normal count of events - alert:
@Name('CiscoEventPer5Second-insert')
insert into CiscoDeviceEventPer5Second
select device_ip,msg_id, count(*) as cnt5sec
from Event(device_type='ciscoasa'
).win:time_batch(5 second)
group by device_ip,msg_id;
@RSAAlert
@Name('ASA-EventsFastIncrease')
select device_ip,msg_id, avg(cnt5sec) as avg60, cnt5sec as Count5
from CiscoDeviceEventPer5Second().win:time(60 seconds)
group by device_ip,msg_id
having avg(cnt5sec)>10 AND cnt5sec > avg(cnt5sec) * 10
output first every 15 min;
- an user have profile location/providers what he use to connect through VPN. If appear new location/provider and increase up to 97% of all connections from this user - alert:
create window loginProfileASN.win:keepall()
(login string,param string,value string,v_count long)
ON EVENT() e
MERGE loginProfileASN p
where p.login=e.login and p.value=(e.geoip('asn')).toString()
when not matched
then insert select login,'ASN' param, geoip('asn') value,1L v_count
when matched
then update set p.v_count = p.v_count+1
create window loginProfileTotal.win:keepall()
(login string,param string,total long)
ON EVENT() e
MERGE loginProfileTotal p
where p.login=e.login
when not matched
then insert select login,'ASN' param, 1L total
when matched
then update set p.total = p.total+1
SELECT e.login,e.geoip('asn') asn, e.src_ip,
FROM event().std:lastevent() e, loginProfileASN v,
loginProfileTotal t
where v.login=e.login and v.value=(e.geoip('asn')).toString()
and t.login = e.login
and (100-100*v.v_count/t.total)>97
2016-04-20 04:20 AM
Nice rules!
2016-08-10 08:24 AM
Hi David,
is there any other way how to check this in 10.6.1?
Thanks
2016-11-11 05:42 AM
Not sure about 10.6.1 but in 10.6.2 you can check it as follows:
cd /CEP/Engine/cepWindows
localhost:com.rsa.netwitness.esa:/CEP/Engine/cepWindows>jmx-invoke query --param "select * from CountEvent2"
[{
"CountEvent2": {
"event_desc": "An account was successfully logged on.",
"mycounter": 2921,
"starttime": "Fri Nov 11 10:00:20 UTC 2016",
"endtime": "Fri Nov 11 10:39:29 UTC 2016"
}
}
]
2016-11-14 05:35 AM
In 10.6.1,
localhost:com.rsa.netwitness.esa:/CEP/Engine/cepEngine>jmx-invoke query --param "select * from CountEvent2"
Operation query invocation failed [No operation named 'query' in the current bean]