Highlighted
Absent Member.
Absent Member.
428 views

extending Record.prototype?


Hello,

my javascript skills are not so good as I could easily write the
collector code to expand a function in a standard collector (here SUSE
Enterpr.):

In the original code there is a code like:
Record.prototype["parse-postfix/smptpd"] = function(message,
e){....}

There are some log parsing rules missing so I like to expand this object
with my parsing rules added.
But how to write this javascript code?

Defining the same statement as above overwrites the original definition.

I am thinking of a pseudo-code like:
- first work on the original ["parse-postfix/smptpd"]-function
- then call my new ["parse-postfix/smptpd"] function to parse new
code

It has to be parsed here and in this way because in the connector code
at the beginning of all parsing there is a code like:
rt= Record.prototype["parse-"+this.s_AppID];
if (rt==false) send_unparsed;
Therefore if the event/App_id has no prototype events sent as
unparsed()..

Torsten


--
tfechner
------------------------------------------------------------------------
tfechner's Profile: https://forums.netiq.com/member.php?userid=8929
View this thread: https://forums.netiq.com/showthread.php?t=55356

0 Likes
2 Replies
Highlighted
Absent Member.
Absent Member.

Hi Torsten,


On 12.02.2016 13:54, tfechner wrote:
>
> Hello,
>
> my javascript skills are not so good as I could easily write the
> collector code to expand a function in a standard collector (here SUSE
> Enterpr.):
>
> In the original code there is a code like:
> Record.prototype["parse-postfix/smptpd"] = function(message,
> e){....}
>
> There are some log parsing rules missing so I like to expand this object
> with my parsing rules added.
> But how to write this javascript code?
>
> Defining the same statement as above overwrites the original definition.
>
> I am thinking of a pseudo-code like:
> - first work on the original ["parse-postfix/smptpd"]-function
> - then call my new ["parse-postfix/smptpd"] function to parse new
> code


I would copy the whole function definion to your release.js and then
modify it to meet your needs. If you're happy with the result, submit
the code as an enhancement request to the SLES Collector in Bugzilla
(https://bugzilla.netiq.com/enter_bug.cgi?product=Sentinel%20Plug-ins)

Norbert


> It has to be parsed here and in this way because in the connector code
> at the beginning of all parsing there is a code like:
> rt= Record.prototype["parse-"+this.s_AppID];
> if (rt==false) send_unparsed;
> Therefore if the event/App_id has no prototype events sent as
> unparsed()..
>
> Torsten
>
>



--
Norbert
0 Likes
Highlighted
Absent Member.
Absent Member.


Norbert Klasen;265200 Wrote:
> Hi Torsten,
>
>
> On 12.02.2016 13:54, tfechner wrote:
> >
> > Hello,
> >
> > my javascript skills are not so good as I could easily write the
> > collector code to expand a function in a standard collector (here

> SUSE
> > Enterpr.):
> >
> > In the original code there is a code like:
> > Record.prototype["parse-postfix/smptpd"] = function(message,
> > e){....}
> >
> > There are some log parsing rules missing so I like to expand this

> object
> > with my parsing rules added.
> > But how to write this javascript code?
> >
> > Defining the same statement as above overwrites the original

> definition.
> >
> > I am thinking of a pseudo-code like:
> > - first work on the original ["parse-postfix/smptpd"]-function
> > - then call my new ["parse-postfix/smptpd"] function to parse new
> > code

>
> I would copy the whole function definion to your release.js and then
> modify it to meet your needs. If you're happy with the result, submit
> the code as an enhancement request to the SLES Collector in Bugzilla
> (https://bugzilla.netiq.com/enter_bug.cgi?product=Sentinel%20Plug-ins)
>
> Norbert
>
>
> > It has to be parsed here and in this way because in the connector

> code
> > at the beginning of all parsing there is a code like:
> > rt= Record.prototype["parse-"+this.s_AppID];
> > if (rt==false) send_unparsed;
> > Therefore if the event/App_id has no prototype events sent as
> > unparsed()..
> >
> > Torsten
> >
> >

>
>
> --
> Norbert


Especially with a collectorlike SUSE where we know everyone has it,
don't even bother to submit as an enhancement, open an SR and a bug and
supply your fix through that. If you don't want to bother with the fix
and are willing to wait ~3-5 working days to get a patch turned around,
just submit the SR - but we're always willing to accept the help.

Brandon


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

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.