Author |
Message
|
vladd |
Posted: Thu Mar 25, 2021 3:57 am Post subject: Monitoring event filters (IIB10) |
|
|
Newbie
Joined: 25 Mar 2021 Posts: 4
|
I need to capture some events using monitoring feature when a certain Boolean $Environment variable is TRUE. But I can't get it to work.
Until now I've tried the following to add in Filter XPath field:
1.
Code: |
$Environment/Variables/DebugLogging=true() |
DebugLogging = FALSE => LOG YES
DebugLogging = TRUE => LOG YES
2.
Code: |
$Environment/Variables[DebugLogging=true()] |
DebugLogging = FALSE => LOG NO
DebugLogging = TRUE => LOG NO
3.
Code: |
$Environment/Variables/DebugLogging |
DebugLogging = FALSE => LOG NO
DebugLogging = TRUE => LOG NO
4.
Code: |
$Environment/Variables/DebugLogging=TRUE |
DebugLogging = FALSE => LOG NO
DebugLogging = TRUE => LOG NO
5.
Code: |
$Environment/Variables/DebugLogging!=false() |
DebugLogging = FALSE => LOG YES
DebugLogging = TRUE => LOG YES
6.
Code: |
$Environment/Variables/DebugLogging=1 |
DebugLogging = FALSE => LOG NO
DebugLogging = TRUE => LOG NO
What am I doing wrong?  |
|
Back to top |
|
 |
timber |
Posted: Fri Mar 26, 2021 6:52 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
|
Back to top |
|
 |
vladd |
Posted: Fri Mar 26, 2021 9:37 am Post subject: |
|
|
Newbie
Joined: 25 Mar 2021 Posts: 4
|
timber wrote: |
See
The language accepted by this field is XPath, so there is no point in trying any expression that is not a valid XPath.
Are you sure that you are allowed to reference the Environment tree from this field? Have you tried referencing something in $Body to check that the filter mechanism is working? |
My first example is XPath 1.0 accepted (also simulated here freeformatter. com/xpath-tester.html#ad-output)
But your url helped a lot. It worked like this:
Code: |
$Environment/Variables/DebugLogging='true' |
Against all my believes and instincts but it works
 |
|
Back to top |
|
 |
timber |
Posted: Mon Mar 29, 2021 1:29 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
Quote: |
your url helped a lot |
It's not mine. It is the IBM documentation for your task, so the first place that you should have looked!
I assume that your message flow is setting the Environment field to the string value 'true'. That explains why your XPaths did not work - they were testing for a Boolean result. |
|
Back to top |
|
 |
vladd |
Posted: Tue Mar 30, 2021 1:15 am Post subject: |
|
|
Newbie
Joined: 25 Mar 2021 Posts: 4
|
timber wrote: |
Quote: |
your url helped a lot |
It's not mine. It is the IBM documentation for your task, so the first place that you should have looked!
I assume that your message flow is setting the Environment field to the string value 'true'. That explains why your XPaths did not work - they were testing for a Boolean result. |
No, actually it is SET as Boolean ( the value comes from an external Boolean variable), this is why is strange for me to evaluate it against 'true'. |
|
Back to top |
|
 |
timber |
Posted: Tue Mar 30, 2021 3:55 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
Quote: |
No, actually it is SET as Boolean |
Can you verify that using the output of a Trace node? |
|
Back to top |
|
 |
vladd |
Posted: Tue Mar 30, 2021 1:32 pm Post subject: |
|
|
Newbie
Joined: 25 Mar 2021 Posts: 4
|
Code: |
2021-03-31 00:18:16.964778 83920 UserTrace BIP2537I: Node 'monitoring_test.Compute': Executing statement ''SET Environment.Variables.DebugLogging = DebugLogging;'' at ('.monitoring_test_Compute.Main', '5.3').
2021-03-31 00:18:16.964792 83920 UserTrace BIP2539I: Node '{5}': Evaluating expression '{4}' at ('DebugLogging', 'FALSE'). This resolved to ''DebugLogging''. The result was ''.
2021-03-31 00:18:16.964804 83920 UserTrace BIP2566I: Node 'monitoring_test.Compute': Assigning value ''FALSE'' to field / variable ''Environment.Variables.DebugLogging''.
|
from debug i can see the variable is set as Boolean:
Code: |
Environment
Variables
DebugLogging:BOOLEAN:false
|
and the actual xPath evaluations are:
Code: |
2021-03-31 00:18:16.965078 83920 UserTrace BIP4074I: The event filter on the event emitted by event source ''Log1.terminal.in'' in flow ''monitoring_test'' has been evaluated and returned 'TRUE'. The query text was ''$Environment/Variables/DebugLogging = true()''.
The event filter, which controls whether an event is emitted, has been evaluated for event source ''Log1.terminal.in'' in flow ''monitoring_test''.
The result of the evaluation was 'TRUE'.
The query text evaluated was ''$Environment/Variables/DebugLogging = true()''. |
and (the one that actually works):
Code: |
2021-03-31 00:18:16.965258 83920 UserTrace BIP4074I: The event filter on the event emitted by event source ''Log2.terminal.in'' in flow ''monitoring_test'' has been evaluated and returned 'FALSE'. The query text was ''$Environment/Variables/DebugLogging = 'true'''.
The event filter, which controls whether an event is emitted, has been evaluated for event source ''Log2.terminal.in'' in flow ''monitoring_test''.
The result of the evaluation was 'FALSE'.
The query text evaluated was ''$Environment/Variables/DebugLogging = 'true'''. |
[/code] |
|
Back to top |
|
 |
timber |
Posted: Tue Mar 30, 2021 1:48 pm Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
Thanks Vladd - that looks very much like a product defect to me. I think your first XPath should work. |
|
Back to top |
|
 |
|