You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by Nikolaos Dalezios <da...@gmail.com> on 2019/03/10 09:52:21 UTC

[DISCUSS] CallContext and related questions

Hello developers. I am implementing CADF event logging . In "server"
project, in class ActionEventUtils, I am calling  my method to log the CADF
event.
Something like

createCadfRecord(EventVO event)

All the mapping and information I am using for CADF are being extracted
from the event.
My problem is what happens when I want to use information from other
classes (ApiServlet.java)? I am not asking for general information on
interclass communication.
eg. I want to use the clientIpAddress from ApiServlet.java to
ActionEventUtils.java

Is CallContext a valid choice/solution?

In ApiServlet.java, method processRequestInContext, I am adding to
CallContext.current() the ip address (or any arbitary data).

In ActionEventUtils when I try to get that data the value is null. After a
little debugging I noticed that the contextid in ActionEventUtils is
different from that in ApiServlet.

Any ideas?

Thank you

Nikos Dalezios

Re: [DISCUSS] CallContext and related questions

Posted by Daan Hoogland <da...@gmail.com>.
Yes, that would seem appropriate

On Tue, Mar 12, 2019 at 12:08 AM Nikolaos Dalezios <da...@gmail.com>
wrote:

> To simplify the question,
> How to share a variable/object from ApiServlet class to ActionEventUtils
> class? Is CallCotnext the correct way?
>
> Στις Κυρ, 10 Μαρ 2019 στις 11:12 μ.μ., ο/η Nikolaos Dalezios <
> dalezni@gmail.com> έγραψε:
>
> > Thank you Daan,
> > I'm proposing an alternative format to store events (at the moment to a
> > log file, not to database).
> > You are right about the fact that all necessary information is  in the
> > event.
> > But, in order to extend the auditing capabilities, additional information
> > would be nice to be added to the event
> > such as ip address and agent of the request.
> >
> > If I've got it right, in Cloudstack the event is being created and posted
> > to db in ActionEventUtils.java (server project).
> > Additional information is being stored to log files (api.log) in
> > ApiServlet.java (server project).
> >
> > My goal is to combine the information of the EventVO (as defined in
> > CloudStack) and the api.log record
> >
> > Στις Κυρ, 10 Μαρ 2019 στις 10:24 μ.μ., ο/η Daan Hoogland <
> > daan.hoogland@gmail.com> έγραψε:
> >
> >> Nikos, I am not sure if I understand your objective. It would seem to me
> >> that all information to proces an event should be in the event. Does it
> >> suffice to add information to the event message for your purposes?
> >>
> >> On Sun, Mar 10, 2019 at 10:52 AM Nikolaos Dalezios <da...@gmail.com>
> >> wrote:
> >>
> >> > Hello developers. I am implementing CADF event logging . In "server"
> >> > project, in class ActionEventUtils, I am calling  my method to log the
> >> CADF
> >> > event.
> >> > Something like
> >> >
> >> > createCadfRecord(EventVO event)
> >> >
> >> > All the mapping and information I am using for CADF are being
> extracted
> >> > from the event.
> >> > My problem is what happens when I want to use information from other
> >> > classes (ApiServlet.java)? I am not asking for general information on
> >> > interclass communication.
> >> > eg. I want to use the clientIpAddress from ApiServlet.java to
> >> > ActionEventUtils.java
> >> >
> >> > Is CallContext a valid choice/solution?
> >> >
> >> > In ApiServlet.java, method processRequestInContext, I am adding to
> >> > CallContext.current() the ip address (or any arbitary data).
> >> >
> >> > In ActionEventUtils when I try to get that data the value is null.
> >> After a
> >> > little debugging I noticed that the contextid in ActionEventUtils is
> >> > different from that in ApiServlet.
> >> >
> >> > Any ideas?
> >> >
> >> > Thank you
> >> >
> >> > Nikos Dalezios
> >> >
> >>
> >>
> >> --
> >> Daan
> >>
> >
>


-- 
Daan

Re: [DISCUSS] CallContext and related questions

Posted by Nikolaos Dalezios <da...@gmail.com>.
To simplify the question,
How to share a variable/object from ApiServlet class to ActionEventUtils
class? Is CallCotnext the correct way?

Στις Κυρ, 10 Μαρ 2019 στις 11:12 μ.μ., ο/η Nikolaos Dalezios <
dalezni@gmail.com> έγραψε:

> Thank you Daan,
> I'm proposing an alternative format to store events (at the moment to a
> log file, not to database).
> You are right about the fact that all necessary information is  in the
> event.
> But, in order to extend the auditing capabilities, additional information
> would be nice to be added to the event
> such as ip address and agent of the request.
>
> If I've got it right, in Cloudstack the event is being created and posted
> to db in ActionEventUtils.java (server project).
> Additional information is being stored to log files (api.log) in
> ApiServlet.java (server project).
>
> My goal is to combine the information of the EventVO (as defined in
> CloudStack) and the api.log record
>
> Στις Κυρ, 10 Μαρ 2019 στις 10:24 μ.μ., ο/η Daan Hoogland <
> daan.hoogland@gmail.com> έγραψε:
>
>> Nikos, I am not sure if I understand your objective. It would seem to me
>> that all information to proces an event should be in the event. Does it
>> suffice to add information to the event message for your purposes?
>>
>> On Sun, Mar 10, 2019 at 10:52 AM Nikolaos Dalezios <da...@gmail.com>
>> wrote:
>>
>> > Hello developers. I am implementing CADF event logging . In "server"
>> > project, in class ActionEventUtils, I am calling  my method to log the
>> CADF
>> > event.
>> > Something like
>> >
>> > createCadfRecord(EventVO event)
>> >
>> > All the mapping and information I am using for CADF are being extracted
>> > from the event.
>> > My problem is what happens when I want to use information from other
>> > classes (ApiServlet.java)? I am not asking for general information on
>> > interclass communication.
>> > eg. I want to use the clientIpAddress from ApiServlet.java to
>> > ActionEventUtils.java
>> >
>> > Is CallContext a valid choice/solution?
>> >
>> > In ApiServlet.java, method processRequestInContext, I am adding to
>> > CallContext.current() the ip address (or any arbitary data).
>> >
>> > In ActionEventUtils when I try to get that data the value is null.
>> After a
>> > little debugging I noticed that the contextid in ActionEventUtils is
>> > different from that in ApiServlet.
>> >
>> > Any ideas?
>> >
>> > Thank you
>> >
>> > Nikos Dalezios
>> >
>>
>>
>> --
>> Daan
>>
>

Re: [DISCUSS] CallContext and related questions

Posted by Nikolaos Dalezios <da...@gmail.com>.
Thank you Daan,
I'm proposing an alternative format to store events (at the moment to a log
file, not to database).
You are right about the fact that all necessary information is  in the
event.
But, in order to extend the auditing capabilities, additional information
would be nice to be added to the event
such as ip address and agent of the request.

If I've got it right, in Cloudstack the event is being created and posted
to db in ActionEventUtils.java (server project).
Additional information is being stored to log files (api.log) in
ApiServlet.java (server project).

My goal is to combine the information of the EventVO (as defined in
CloudStack) and the api.log record

Στις Κυρ, 10 Μαρ 2019 στις 10:24 μ.μ., ο/η Daan Hoogland <
daan.hoogland@gmail.com> έγραψε:

> Nikos, I am not sure if I understand your objective. It would seem to me
> that all information to proces an event should be in the event. Does it
> suffice to add information to the event message for your purposes?
>
> On Sun, Mar 10, 2019 at 10:52 AM Nikolaos Dalezios <da...@gmail.com>
> wrote:
>
> > Hello developers. I am implementing CADF event logging . In "server"
> > project, in class ActionEventUtils, I am calling  my method to log the
> CADF
> > event.
> > Something like
> >
> > createCadfRecord(EventVO event)
> >
> > All the mapping and information I am using for CADF are being extracted
> > from the event.
> > My problem is what happens when I want to use information from other
> > classes (ApiServlet.java)? I am not asking for general information on
> > interclass communication.
> > eg. I want to use the clientIpAddress from ApiServlet.java to
> > ActionEventUtils.java
> >
> > Is CallContext a valid choice/solution?
> >
> > In ApiServlet.java, method processRequestInContext, I am adding to
> > CallContext.current() the ip address (or any arbitary data).
> >
> > In ActionEventUtils when I try to get that data the value is null. After
> a
> > little debugging I noticed that the contextid in ActionEventUtils is
> > different from that in ApiServlet.
> >
> > Any ideas?
> >
> > Thank you
> >
> > Nikos Dalezios
> >
>
>
> --
> Daan
>

Re: [DISCUSS] CallContext and related questions

Posted by Daan Hoogland <da...@gmail.com>.
Nikos, I am not sure if I understand your objective. It would seem to me
that all information to proces an event should be in the event. Does it
suffice to add information to the event message for your purposes?

On Sun, Mar 10, 2019 at 10:52 AM Nikolaos Dalezios <da...@gmail.com>
wrote:

> Hello developers. I am implementing CADF event logging . In "server"
> project, in class ActionEventUtils, I am calling  my method to log the CADF
> event.
> Something like
>
> createCadfRecord(EventVO event)
>
> All the mapping and information I am using for CADF are being extracted
> from the event.
> My problem is what happens when I want to use information from other
> classes (ApiServlet.java)? I am not asking for general information on
> interclass communication.
> eg. I want to use the clientIpAddress from ApiServlet.java to
> ActionEventUtils.java
>
> Is CallContext a valid choice/solution?
>
> In ApiServlet.java, method processRequestInContext, I am adding to
> CallContext.current() the ip address (or any arbitary data).
>
> In ActionEventUtils when I try to get that data the value is null. After a
> little debugging I noticed that the contextid in ActionEventUtils is
> different from that in ApiServlet.
>
> Any ideas?
>
> Thank you
>
> Nikos Dalezios
>


-- 
Daan