evtctxcnt()
Returns the number of event contexts currently existing for a specified topic. Use this function to determine the count of event contexts created by the evtctx command.
Syntax
evtctxcnt(TOPIC)
Parameters
TOPIC- The topic name for which to query the event context count. String. If
nullis specified, the total count of event contexts across all topics is returned.
Description
Returns the number of event contexts for the given TOPIC as a 32-bit integer.
If TOPIC is null, the function returns the total count of event contexts across all topics.
If there are no event contexts for the specified topic, 0 is returned.
Error codes
| Error code | Description |
|---|---|
invalid-evtctxcnt-arguments | The number of arguments is not 1. |
Usage examples
-
Query the current number of event contexts in the
login_failtopicevtctx topic=login_fail key=src_user max_count=5 | eval ctx_count = evtctxcnt("login_fail") -
Pass
nullas the topic argument to query the total number of event contexts across all topicsevtctx topic=login_fail key=src_user | eval total = evtctxcnt(null) -
Query a topic that has no event contexts
evtctx topic=login_fail key=src_user | eval cnt = evtctxcnt("no_such_topic") | # cnt: 0
Compatibility
evtctxcnt() has been available since before Sonar 4.0.