Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
Highlighted
cnrossi Absent Member.
Absent Member.
1111 views

Could not update Correlated Event on custom action

Hi, I'm trying to update some fields of the correlated event in a Sentinel custom action. This is my code:

var corrEvt = scriptEnv.getCorrelatedEvent();
corrEvt.setCv21( "Custom message" );
corrEvt.save();

If I put it inside the Input.prototype.get() method it works fine. but when I put it in normalize() or doAction() it raises this error:

Tue Jun 23 19:21:21 ART 2015|SEVERE|pool-34-thread-2|esecurity.ccs.comp.script.executor.JavaScriptExecutor.execute
; Exception Wrapped java.lang.RuntimeException: Attempt to modify Final object Event attribute cv21 (/var/opt/novell/sentinel/data/server.cache/javascript_action_plugins/EmailSites_87CA9EDE210103290E26762249A8966_8477924901603745221/main.script#420); org.mozilla.javascript.WrappedException; ; Caused by Attempt to modify Final object Event attribute cv21; java.lang.RuntimeException;
Tue Jun 23 19:21:21 ART 2015|SEVERE|pool-34-thread-2|esecurity.ccs.comp.script.executor.JavaScriptExecutor.execute
org.mozilla.javascript.WrappedException: Wrapped java.lang.RuntimeException: Attempt to modify Final object Event attribute cv21 (/var/opt/novell/sentinel/data/server.cache/javascript_action_plugins/EmailSites_87CA9EDE210103290E26762249A8966_8477924901603745221/main.script#420)
at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1757)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:170)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:243)
at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
at compiled._c12(/var/opt/novell/sentinel/data/server.cache/javascript_action_plugins/EmailSites_87CA9EDE210103290E26762249A8966_8477924901603745221/main.script:420)
at compiled.call(/var/opt/novell/sentinel/data/server.cache/javascript_action_plugins/EmailSites_87CA9EDE210103290E26762249A8966_8477924901603745221/main.script)
at org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRuntime.java:119)
at compiled._c0(/var/opt/novell/sentinel/data/server.cache/javascript_action_plugins/EmailSites_87CA9EDE210103290E26762249A8966_8477924901603745221/main.script:7693)
at compiled.call(/var/opt/novell/sentinel/data/server.cache/javascript_action_plugins/EmailSites_87CA9EDE210103290E26762249A8966_8477924901603745221/main.script)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
at compiled.call(/var/opt/novell/sentinel/data/server.cache/javascript_action_plugins/EmailSites_87CA9EDE210103290E26762249A8966_8477924901603745221/main.script)
at compiled.exec(/var/opt/novell/sentinel/data/server.cache/javascript_action_plugins/EmailSites_87CA9EDE210103290E26762249A8966_8477924901603745221/main.script)
at esecurity.ccs.comp.script.executor.JavaScriptExecutor.execute(JavaScriptExecutor.java:105)
at esecurity.ccs.comp.correlation.action.CorrelationScriptExecutor$2.run(CorrelationScriptExecutor.java:322)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: Attempt to modify Final object Event attribute cv21
at esecurity.base.datamodel.BaseAttributeObject.setAttribute(BaseAttributeObject.java:273)
at esecurity.db.object.EventImpl.setCv21(EventImpl.java:14543)
at esecurity.db.object.EventWrapper.setCv21(EventWrapper.java:14546)
at esecurity.db.object.EventWrapper.setCv21(EventWrapper.java:14546)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:155)
... 18 more


Is there any restriction to use this functions outside get() method ?

Thanks in advance !
Tags (3)
0 Likes
9 Replies
Micro Focus Expert
Micro Focus Expert

Re: Could not update Correlated Event on custom action

Hi,
if you make your modifications in Input.prototype.get(), does Sentinel
actually persist that to disk? I.e. if you later serach for st:C AND
cv21:"Custom message" does that turn up any results? That would surprise me
as I always though that (correleated) events send to actions would be
immutable.

Norbert



>>> On 24.06.2015 at 00:36, cnrossi<cnrossi@no-mx.forums.microfocus.com>

wrote:

> Hi, I'm trying to update some fields of the correlated event in a
> Sentinel custom action. This is my code:
>
> var corrEvt = scriptEnv.getCorrelatedEvent();
> corrEvt.setCv21( "Custom message" );
> corrEvt.save();
>
> If I put it inside the Input.prototype.get() method it works fine. but
> when I put it in normalize() or doAction() it raises this error:
>
> Tue Jun 23 19:21:21 ART
>

2015|SEVERE|pool‑34‑thread‑2|esecurity.ccs.comp.script.executor.JavaSc
riptE
> xecutor.execute
> ; Exception Wrapped java.lang.RuntimeException: *Attempt to modify
> Final object Event attribute cv21
> *(/var/opt/novell/sentinel/data/server.cache/javascript_action_plugins/E
> mailSites_87CA9EDE210103290E26762249A8966_8477924901603745221/main.script


> #420);
> org.mozilla.javascript.WrappedException; ; Caused by Attempt to modify
> Final object Event attribute cv21; java.lang.RuntimeException;
> Tue Jun 23 19:21:21 ART
>

2015|SEVERE|pool‑34‑thread‑2|esecurity.ccs.comp.script.executor.JavaSc
riptE
> xecutor.execute
> org.mozilla.javascript.WrappedException: Wrapped
> java.lang.RuntimeException: Attempt to modify Final object Event
> attribute cv21
> (/var/opt/novell/sentinel/data/server.cache/javascript_action_plugins/Em
> ailSites_87CA9EDE210103290E26762249A8966_8477924901603745221/main.script#


> 420)
> at
> org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1757)
> at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:170)
> at
> org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:243)
> at
> org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
> at
> compiled._c12(/var/opt/novell/sentinel/data/server.cache/javascript_acti
> on_plugins/EmailSites_87CA9EDE210103290E26762249A8966_8477924901603745221


> /main.script:420)
> at
> compiled.call(/var/opt/novell/sentinel/data/server.cache/javascript_acti
> on_plugins/EmailSites_87CA9EDE210103290E26762249A8966_8477924901603745221


> /main.script)
> at
> org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRuntime.java:11
> 9)
> at
> compiled._c0(/var/opt/novell/sentinel/data/server.cache/javascript_actio
> n_plugins/EmailSites_87CA9EDE210103290E26762249A8966_8477924901603745221/


> main.script:7693)
> at
> compiled.call(/var/opt/novell/sentinel/data/server.cache/javascript_acti
> on_plugins/EmailSites_87CA9EDE210103290E26762249A8966_8477924901603745221


> /main.script)
> at
> org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
> at
> org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
> at
> compiled.call(/var/opt/novell/sentinel/data/server.cache/javascript_acti
> on_plugins/EmailSites_87CA9EDE210103290E26762249A8966_8477924901603745221


> /main.script)
> at
> compiled.exec(/var/opt/novell/sentinel/data/server.cache/javascript_acti
> on_plugins/EmailSites_87CA9EDE210103290E26762249A8966_8477924901603745221


> /main.script)
> at
> esecurity.ccs.comp.script.executor.JavaScriptExecutor.execute(JavaScript
> Executor.java:105)
> at
> esecurity.ccs.comp.correlation.action.CorrelationScriptExecutor$2.run(Co
> rrelationScriptExecutor.java:322)
> at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
> at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.jav
> a:1145)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.ja
> va:615)
> at java.lang.Thread.run(Thread.java:745)
> Caused by: java.lang.RuntimeException: Attempt to modify Final object
> Event attribute cv21
> at
> esecurity.base.datamodel.BaseAttributeObject.setAttribute(BaseAttributeO
> bject.java:273)
> at esecurity.db.object.EventImpl.setCv21(EventImpl.java:14543)
> at esecurity.db.object.EventWrapper.setCv21(EventWrapper.java:14546)
> at esecurity.db.object.EventWrapper.setCv21(EventWrapper.java:14546)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
> a:57)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
> Impl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:606)
> at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:155)
> ... 18 more
>
>
> Is there any restriction to use this functions outside get() method ?
>
> Thanks in advance !


0 Likes
cnrossi Absent Member.
Absent Member.

Re: Could not update Correlated Event on custom action


I didn't try to find the event in that way but when I search correlated
events triggered from the dashboard I can see the field updated.

Nicolás.

klasen;258348 Wrote:
> Hi,
> if you make your modifications in Input.prototype.get(), does Sentinel
> actually persist that to disk? I.e. if you later serach for st:C AND
> cv21:"Custom message" does that turn up any results? That would surprise
> me
> as I always though that (correleated) events send to actions would be
> immutable.
>
> Norbert
>
>
>
> >>> On 24.06.2015 at 00:36,

> cnrossi<cnrossi@no-mx.forums.microfocus.com>
> wrote:
>
> > Hi, I'm trying to update some fields of the correlated event in a
> > Sentinel custom action. This is my code:
> >
> > var corrEvt = scriptEnv.getCorrelatedEvent();
> > corrEvt.setCv21( "Custom message" );
> > corrEvt.save();
> >
> > If I put it inside the Input.prototype.get() method it works fine.

> but
> > when I put it in normalize() or doAction() it raises this error:
> >
> > Tue Jun 23 19:21:21 ART
> >

> 2015|SEVERE|pool‑34‑thread‑2|esecurity.ccs.comp.script.executor.JavaSc
> riptE
> > xecutor.execute
> > ; Exception Wrapped java.lang.RuntimeException: *Attempt to modify
> > Final object Event attribute cv21
> >

> *(/var/opt/novell/sentinel/data/server.cache/javascript_action_plugins/E
> >

> mailSites_87CA9EDE210103290E26762249A8966_8477924901603745221/main.script
>
> > #420);
> > org.mozilla.javascript.WrappedException; ; Caused by Attempt to

> modify
> > Final object Event attribute cv21; java.lang.RuntimeException;
> > Tue Jun 23 19:21:21 ART
> >

> 2015|SEVERE|pool‑34‑thread‑2|esecurity.ccs.comp.script.executor.JavaSc
> riptE
> > xecutor.execute
> > org.mozilla.javascript.WrappedException: Wrapped
> > java.lang.RuntimeException: Attempt to modify Final object Event
> > attribute cv21
> >

> (/var/opt/novell/sentinel/data/server.cache/javascript_action_plugins/Em
> >

> ailSites_87CA9EDE210103290E26762249A8966_8477924901603745221/main.script#
>
> > 420)
> > at
> >

> org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1757)
> > at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:170)
> > at
> >

> org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:243)
> > at
> > org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
> > at
> >

> compiled._c12(/var/opt/novell/sentinel/data/server.cache/javascript_acti
> >

> on_plugins/EmailSites_87CA9EDE210103290E26762249A8966_8477924901603745221
>
> > /main.script:420)
> > at
> >

> compiled.call(/var/opt/novell/sentinel/data/server.cache/javascript_acti
> >

> on_plugins/EmailSites_87CA9EDE210103290E26762249A8966_8477924901603745221
>
> > /main.script)
> > at
> >

> org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRuntime.java:11
> > 9)
> > at
> >

> compiled._c0(/var/opt/novell/sentinel/data/server.cache/javascript_actio
> >

> n_plugins/EmailSites_87CA9EDE210103290E26762249A8966_8477924901603745221/
>
> > main.script:7693)
> > at
> >

> compiled.call(/var/opt/novell/sentinel/data/server.cache/javascript_acti
> >

> on_plugins/EmailSites_87CA9EDE210103290E26762249A8966_8477924901603745221
>
> > /main.script)
> > at
> >

> org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
> > at
> >

> org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
> > at
> >

> compiled.call(/var/opt/novell/sentinel/data/server.cache/javascript_acti
> >

> on_plugins/EmailSites_87CA9EDE210103290E26762249A8966_8477924901603745221
>
> > /main.script)
> > at
> >

> compiled.exec(/var/opt/novell/sentinel/data/server.cache/javascript_acti
> >

> on_plugins/EmailSites_87CA9EDE210103290E26762249A8966_8477924901603745221
>
> > /main.script)
> > at
> >

> esecurity.ccs.comp.script.executor.JavaScriptExecutor.execute(JavaScript
> > Executor.java:105)
> > at
> >

> esecurity.ccs.comp.correlation.action.CorrelationScriptExecutor$2.run(Co
> > rrelationScriptExecutor.java:322)
> > at
> >

> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
> > at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> > at
> >

> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.jav
> > a:1145)
> > at
> >

> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.ja
> > va:615)
> > at java.lang.Thread.run(Thread.java:745)
> > Caused by: java.lang.RuntimeException: Attempt to modify Final

> object
> > Event attribute cv21
> > at
> >

> esecurity.base.datamodel.BaseAttributeObject.setAttribute(BaseAttributeO
> > bject.java:273)
> > at esecurity.db.object.EventImpl.setCv21(EventImpl.java:14543)
> > at

> esecurity.db.object.EventWrapper.setCv21(EventWrapper.java:14546)
> > at

> esecurity.db.object.EventWrapper.setCv21(EventWrapper.java:14546)
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at
> >

> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
> > a:57)
> > at
> >

> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
> > Impl.java:43)
> > at java.lang.reflect.Method.invoke(Method.java:606)
> > at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:155)
> > ... 18 more
> >
> >
> > Is there any restriction to use this functions outside get() method ?
> >
> > Thanks in advance !



--
cnrossi
------------------------------------------------------------------------
cnrossi's Profile: https://forums.netiq.com/member.php?userid=937
View this thread: https://forums.netiq.com/showthread.php?t=53751

0 Likes
brandon-langley Absent Member.
Absent Member.

Re: Could not update Correlated Event on custom action


cnrossi;258363 Wrote:
> I didn't try to find the event in that way but when I search correlated
> events triggered from the dashboard I can see the field updated.
>
> Nicolás.


FYI, as Norbert mentioned, these objects are intended to be immutable.
This technique is not guaranteed to work in the long run.


--
brandon.langley
------------------------------------------------------------------------
brandon.langley's Profile: https://forums.netiq.com/member.php?userid=350
View this thread: https://forums.netiq.com/showthread.php?t=53751

0 Likes
cnrossi Absent Member.
Absent Member.

Re: Could not update Correlated Event on custom action

So what should I do ? Create a new correlated event ? I found an example here in the forum:

https://forums.novell.com/showthread.php/491389-Correlation-JS-Action

But I am not sure if it should work in the long run as Brandon said.

brandon.langley;2398587 wrote:
cnrossi;258363 Wrote:
> I didn't try to find the event in that way but when I search correlated
> events triggered from the dashboard I can see the field updated.
>
> Nicolás.


FYI, as Norbert mentioned, these objects are intended to be immutable.
This technique is not guaranteed to work in the long run.


--
brandon.langley
------------------------------------------------------------------------
brandon.langley's Profile: https://forums.netiq.com/member.php?userid=350
View this thread: https://forums.netiq.com/showthread.php?t=53751
0 Likes
Knowledge Partner
Knowledge Partner

Re: Could not update Correlated Event on custom action

What is the purpose of your real modification (not just the test stuff you
posted here)? Perhaps knowing the business case we can help a bit more.

--
Good luck.

If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below...
0 Likes
cnrossi Absent Member.
Absent Member.

Re: Could not update Correlated Event on custom action


Our team is developing a custom action as a trigger of a correlated
event. This action does some stuff and then it should generate a custom
ID (like a tickcet ID). I need this ID linked to all events that
triggered the correlation rule. Maybe I should clone the correlated
event or create a new one.

ab;258456 Wrote:
> What is the purpose of your real modification (not just the test stuff
> you
> posted here)? Perhaps knowing the business case we can help a bit
> more.
>
> --
> Good luck.
>
> If you find this post helpful and are logged into the web interface,
> show your appreciation and click on the star below...



--
cnrossi
------------------------------------------------------------------------
cnrossi's Profile: https://forums.netiq.com/member.php?userid=937
View this thread: https://forums.netiq.com/showthread.php?t=53751

0 Likes
Knowledge Partner
Knowledge Partner

Re: Could not update Correlated Event on custom action

When a correlation rule fires, the generated correlated event should have
a unique name based on that correlation rule's name. Does that not work
as the ID linking all events from that rule?

--
Good luck.

If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below...
0 Likes
cnrossi Absent Member.
Absent Member.

Re: Could not update Correlated Event on custom action


I tried that first but our customer needs an ID with the timestamp like
YYYYMMDDHHMI. I also have to update the correlated event because we have
'another issue' (http://tinyurl.com/nf9eh88) counting events and the
action can discard the trigger (updating severity) when correlated
events were already processed.


--
cnrossi
------------------------------------------------------------------------
cnrossi's Profile: https://forums.netiq.com/member.php?userid=937
View this thread: https://forums.netiq.com/showthread.php?t=53751

0 Likes
cnrossi Absent Member.
Absent Member.

Re: Could not update Correlated Event on custom action


Hi ab ! I found a 'post' (http://tinyurl.com/ofbo797) asking the same
feature. I tried several things with no success. Do you have any
suggestion ?


--
cnrossi
------------------------------------------------------------------------
cnrossi's Profile: https://forums.netiq.com/member.php?userid=937
View this thread: https://forums.netiq.com/showthread.php?t=53751

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.