> can you include this information in a line which is printed to standard
output? That would probably be the simplest solution.

Yes. Will do. Thanks for your advice.

best,
Yuheng


On Tue, Aug 19, 2014 at 9:55 AM, Risto Vaarandi <risto.vaara...@seb.ee>
wrote:

>
>
> From: yuheng.du.h...@gmail.com [mailto:yuheng.du.h...@gmail.com] On
> Behalf Of Yuheng Du
> Sent: Tuesday, August 19, 2014 4:50 PM
> To: Risto Vaarandi
> Cc: Risto Vaarandi; simple-evcorr-users@lists.sourceforge.net
> Subject: Re: [Simple-evcorr-users] Single with Script variable return
>
> To make a corrction,
>
> >Based on the average and standard deviation returned from the script, I
> want to create an event telling me which element in my incoming >'readings'
> array has gone abnormal. So I need to interact with my Perl script to get
> the returned 'average' and 'standard deviation' float >values. I know that
> I can pass variable values to perl script in SingleWithScript rule, but I
> don't know how to get returned values.
>
> >From your previous reply, I figured that if I use 'spawn' action, I can
> print the 'average' and 'std_deviation' values to the std out and then
> >capture them in another rule, is that correct?
>
> I need to interact with my Perl script to get some return values. One of
> them telling me how many elements in my incoming 'readings' has gone
> abnormal. The others tells me which slots are them.
>
> --- can you include this information in a line which is printed to
> standard output? That would probably be the simplest solution.
> Kind regards,
> Risto
>
>
> Thanks.
>
> On Tue, Aug 19, 2014 at 9:27 AM, Risto Vaarandi <risto.vaara...@seb.ee>
> wrote:
> Do I understand correctly that you would like to check certain fields of
> json events received from sec inputs? If so, I'd recommend to take
> advantage of the PerlFunc pattern for parsing these events. Almost two
> years ago, there was a discussion in the mailing list which concerned json
> events specifically, and I submitted sample rules for parsing json:
> http://sourceforge.net/p/simple-evcorr/mailman/message/30058671/
>
> In the parsing rules, JSON::decode_json() function is invoked which stores
> its results into a perl hash. It is straighforward to check specific
> keyword-value pairs inside this hash, and include these check within the
> same PerlFunc pattern. Also, if you don't care about flattening json
> structure and setting SEC match variables, you can omit the flatten()
> function from this example altogether, which will make this ruleset really
> short.
>
> Hope this helps,
> risto
>
>
> From: Yuheng Du [mailto:yuhe...@clemson.edu]
> Sent: Tuesday, August 19, 2014 3:41 PM
> To: Risto Vaarandi
> Cc: simple-evcorr-users@lists.sourceforge.net
> Subject: Re: [Simple-evcorr-users] Single with Script variable return
>
> Hi Risto,
>
> The array is intialized and created as the input of SEC. It is of the Json
> format.
>
> Thanks.
>
> Yuheng
>
> On Tue, Aug 19, 2014 at 4:29 AM, Risto Vaarandi <risto.vaara...@gmail.com>
> wrote:
> 2014-08-18 22:37 GMT+03:00 Yuheng Du <yuhe...@clemson.edu>:
> Hi Guys,
>
> Is there any method to the return value of a script in SingleWithScript
> rule?
>
> I have 8 readings in an array and I want to return which (one or many)
> specific items in that array is exceptional using a perl script. Then based
> on the return value of the script, I want to decide my actions.
>
> So I need to return an integer to my rule in order to decide the action.
>
> Can I use SingleWithScript rule to do this? Or is there any other methods?
>
> Where exactly is this array created and how it is initialized? Since there
> is no straightforward way to fetch a child process exit code from rules, it
> might be simpler to have a PerlFunc pattern for executing the perl code and
> setting the array. However, if the perl code involves time-consuming
> external queries, I'd not recommend PerlFunc pattern, since it is not
> executed asynchronously. In that case, you could try the 'spawn' action for
> executing the perl script, and communicate with SEC by generating synthetic
> events from perl script.
> If you prefer to use SingleWithScript, you can also use the following
> strategy -- write the exit code value into a file, and have 'if () else ()'
> statements in your action list for executing different actions based on the
> content of the file.
> hope this helps,
> risto
>
>
> Thanks.
>
> best,
>
> Yuheng
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Simple-evcorr-users mailing list
> Simple-evcorr-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users
>
>
>
------------------------------------------------------------------------------
_______________________________________________
Simple-evcorr-users mailing list
Simple-evcorr-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users

Reply via email to