-
Notifications
You must be signed in to change notification settings - Fork 170
XPathFilter Syntax
XPathFilter works with XPaths. Each message object is treated as a graph, and path in the graph is queried with XPath. See JXPath to see what XPath capability is supported.
xpath("//a/b/c") = "foo" or xpath("count") = 12
xpath("//a/b/c") = "foo" and xpath("count") = 12
not xpath("//a/b/c") > 5
(xpath("//a/b/c") = 5 or xpath("//a/b/c") < 0) and xpath("root") = "foo"
xpath("root") != "value"
xpath("path") between (1, 2)
xpath("path") in ("a", "b", "c")
xpath("path") is null
xpath("path") =~ "?.*"
xpath("path") exists
true
false
xpath("path") = "foo"
xpath("path") !?= 5
xpath("path") > 5
xpath("path") >= time-millis("yyyy-MM-dd", "1997-08-29")
xpath("path") < time-string("yyyy-MM-dd'T'HH:mm:ss:SSS", "yyyy-MM-dd'T'HH:mm:ss:SSS", "2012-08-22T10:14:44:856")
xpath("path") <= 53.2
xpath("//root/first-level-child/another-level").
Note:
-
The string value can be any valid XPath 1.0 value
-
Supported java object: Map and any JavaBean-like object. For example, the following call is corresponding to "//foo/bar/foobar", where the variable myEvent is the event that this XPath will be applied to.
-
myEvent.getFoo().getBar().getFooBar()
####Examples
xpath("//a/b/c/f") = "134.12"
xpath("path") < 12
"a string"
true
false
null
xpath("//a/path/to/a/property")
23
2.718281828459045
6.23e23
time-millis("yyyy-MM-dd'T'HH:mm:ss:SSS", "2012-08-22T10:14:44:856")
time-string("yyyy-MM-dd'T'HH:mm:ss:SSS", "yyyy-MM-dd'T'HH:mm:ss:SSS", "2012-08-22T10:14:44:856")
time-millis("yyyy-MM-dd'T'HH:mm:ss:SSS", "2012-08-22T10:14:44:856")
That is, this method assume an input time value is in milliseconds Signature: time-string(String valueTimeFormat, String timeValue), where
- *valueTimeFormat:*the time format string for the given filter value (the next parameter)
- *timeValue:*The time value used to filter an event.
time-string("yyyy-MM-dd'T'HH:mm:ss:SSS", "yyyy-MM-dd'T'HH:mm:ss:SSS", "2012-08-22T10:14:44:856")
That is, this method assume an input time value is a time string
- Signature: time-string(String inputTimeFormat, String valueTimeFormat, String timeValue), where
- inputTimeFormat: the time format string for a potential event.
- valueTimeFormat: the time format string for the given filter value (the next parameter)
- timeValue: The time value used to filter an event.
####Example
between (6, 10)
xpath("//a/b/ef") between (time-millis("yyyy-MM-dd'T'HH:mm:ss:SSS", "2012-08-22T10:14:44:856"), time-millis("yyyy-MM-dd'T'HH:mm:ss:SSS", "2012-08-22T16:14:44:856"))
xpath("//a/b/ef") between (time-string("yyyy-MM-dd'T'HH:mm:ss:SSS", "yyyy-MM-dd'T'HH:mm:ss:SSS", "2012-08-22T10:14:44:856"), time-string("yyyy-MM-dd'T'HH:mm:ss:SSS", "yyyy-MM-dd'T'HH:mm:ss:SSS", "2012-08-23T10:14:44:856"))
####Example
xpath("path") in (1, 2, 23.0, 4)
xpath("path") in ("ab", "b", "h", "0")
xpath("path") is null
xpath("//a/b/c") =~ "0-9+"
exists xpath("//a/b/c")
xpath("//a/b/c") exists
####Example
// a comment
/* another comment */