You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@karaf.apache.org by dzoni <ch...@zf.com> on 2020/03/30 09:16:09 UTC

REST-Appender-Collector

Hello there,

i'm Building up an infrastructure example for transporting log-Messages to a
target.

In my Case im running in one Karaf (client):
1. my application
2. Decanter log-collector
3. Decanter rest-Appender

there i want the collected data to send into another Karaf (server),
therefor i'm running in the other Karaf follwoing stuff:
1. Decanter rest-collector
2. Decanter rest-servlet-collector

all Transport is by Default on localhost and port 8181

*now i'm getting at the Client Karaf follwing Warn-LOG:*
 WARN [EventAdminThread #11] Error sending event to rest service
java.io.IOException: Server returned HTTP response code: 403 for URL:
http://localhost:8181
        at
sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1900)
~[?:1.8.0_242]
        at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
~[?:1.8.0_242]
        at
org.apache.karaf.decanter.appender.rest.RestAppender.handleEvent(RestAppender.java:93)
[!/:?]
        at
org.apache.felix.eventadmin.impl.handler.EventHandlerProxy.sendEvent(EventHandlerProxy.java:415)
[!/:?]
        at
org.apache.felix.eventadmin.impl.tasks.HandlerTask.run(HandlerTask.java:70)
[!/:?]
        at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[?:1.8.0_242]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[?:1.8.0_242]
        at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[?:1.8.0_242]
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[?:1.8.0_242]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_242]

*and the Server-Karaf is throwing following Warn-Message*
WARN [Karaf_Worker-3] Can't request REST service
java.io.FileNotFoundException: http://localhost:8181/metrics
        at
sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1896)
~[?:1.8.0_242]
        at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
~[?:1.8.0_242]
        at
org.apache.karaf.decanter.collector.rest.RestCollector.run(RestCollector.java:97)
[!/:?]
        at
org.apache.karaf.scheduler.core.QuartzJobExecutor.execute(QuartzJobExecutor.java:60)
[!/:?]
        at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [!/:?]
        at
org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
[!/:?]


Where i have to adjust some diffenrent configurations to solve this
Problem????

thanks for your helpful answers 
dzoni



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-Dev-f930721.html

Re: REST-Appender-Collector

Posted by Jean-Baptiste Onofre <jb...@nanthrax.net>.
Basically, you can do:

- install rest-servlet collector on Karaf A: feature:install decanter-collector-rest-servlet
The endpoint is /decanter/collect by default, so http://karafA:8181/decanter/collect <http://karafa:8181/decanter/collect>
- install rest appender on Karaf B: feature:install decanter-appender-rest. Here you have to configure the target endpoint in etc/org.apache.karaf.decanter.appender.rest.cfg, for instance:
	uri=http://karafA:8181/decanter/collect <http://karafa:8181/decanter/collect>

And it should work. Just install the collector you wants on B (log, jmx, …).

Regards
JB

> Le 30 mars 2020 à 11:59, Jean-Baptiste Onofre <jb...@nanthrax.net> a écrit :
> 
> Hi,
> 
> Did you align the HTTP context in etc/org.apache.karaf.decanter* config files ?
> 
> Regards
> JB
> 
>> Le 30 mars 2020 à 11:16, dzoni <ch...@zf.com> a écrit :
>> 
>> Hello there,
>> 
>> i'm Building up an infrastructure example for transporting log-Messages to a
>> target.
>> 
>> In my Case im running in one Karaf (client):
>> 1. my application
>> 2. Decanter log-collector
>> 3. Decanter rest-Appender
>> 
>> there i want the collected data to send into another Karaf (server),
>> therefor i'm running in the other Karaf follwoing stuff:
>> 1. Decanter rest-collector
>> 2. Decanter rest-servlet-collector
>> 
>> all Transport is by Default on localhost and port 8181
>> 
>> *now i'm getting at the Client Karaf follwing Warn-LOG:*
>> WARN [EventAdminThread #11] Error sending event to rest service
>> java.io.IOException: Server returned HTTP response code: 403 for URL:
>> http://localhost:8181
>>       at
>> sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1900)
>> ~[?:1.8.0_242]
>>       at
>> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
>> ~[?:1.8.0_242]
>>       at
>> org.apache.karaf.decanter.appender.rest.RestAppender.handleEvent(RestAppender.java:93)
>> [!/:?]
>>       at
>> org.apache.felix.eventadmin.impl.handler.EventHandlerProxy.sendEvent(EventHandlerProxy.java:415)
>> [!/:?]
>>       at
>> org.apache.felix.eventadmin.impl.tasks.HandlerTask.run(HandlerTask.java:70)
>> [!/:?]
>>       at
>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
>> [?:1.8.0_242]
>>       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>> [?:1.8.0_242]
>>       at
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>> [?:1.8.0_242]
>>       at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>> [?:1.8.0_242]
>>       at java.lang.Thread.run(Thread.java:748) [?:1.8.0_242]
>> 
>> *and the Server-Karaf is throwing following Warn-Message*
>> WARN [Karaf_Worker-3] Can't request REST service
>> java.io.FileNotFoundException: http://localhost:8181/metrics
>>       at
>> sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1896)
>> ~[?:1.8.0_242]
>>       at
>> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
>> ~[?:1.8.0_242]
>>       at
>> org.apache.karaf.decanter.collector.rest.RestCollector.run(RestCollector.java:97)
>> [!/:?]
>>       at
>> org.apache.karaf.scheduler.core.QuartzJobExecutor.execute(QuartzJobExecutor.java:60)
>> [!/:?]
>>       at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [!/:?]
>>       at
>> org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
>> [!/:?]
>> 
>> 
>> Where i have to adjust some diffenrent configurations to solve this
>> Problem????
>> 
>> thanks for your helpful answers 
>> dzoni
>> 
>> 
>> 
>> --
>> Sent from: http://karaf.922171.n3.nabble.com/Karaf-Dev-f930721.html
> 


Re: REST-Appender-Collector

Posted by Jean-Baptiste Onofre <jb...@nanthrax.net>.
I don’t think it’s a good idea to use the root context as you might have issue/conflict with other application like webconsole. Use a specific context path (like /decanter or /decanter/collect) for instance.
Take a look on the exemple I sent on my other email.

Regards
JB

> Le 30 mars 2020 à 12:09, dzoni <ch...@zf.com> a écrit :
> 
> hi jbonofre,
> 
> i configured the two config files 
> 
> org.apache.karaf.decanter.collector.rest-1
> org.apache.karaf.decanter.appender.rest
> 
> with the same uri and url by http:\\localhaost:8181
> 
> i dont know where to align the http context on a other config!?!
> 
> thank for ur answer
> 
> 
> 
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-Dev-f930721.html


Re: REST-Appender-Collector

Posted by dzoni <ch...@zf.com>.
hi jbonofre,

i configured the two config files 

org.apache.karaf.decanter.collector.rest-1
org.apache.karaf.decanter.appender.rest

with the same uri and url by http:\\localhaost:8181

i dont know where to align the http context on a other config!?!

thank for ur answer



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-Dev-f930721.html

Re: REST-Appender-Collector

Posted by Jean-Baptiste Onofre <jb...@nanthrax.net>.
Hi,

Did you align the HTTP context in etc/org.apache.karaf.decanter* config files ?

Regards
JB

> Le 30 mars 2020 à 11:16, dzoni <ch...@zf.com> a écrit :
> 
> Hello there,
> 
> i'm Building up an infrastructure example for transporting log-Messages to a
> target.
> 
> In my Case im running in one Karaf (client):
> 1. my application
> 2. Decanter log-collector
> 3. Decanter rest-Appender
> 
> there i want the collected data to send into another Karaf (server),
> therefor i'm running in the other Karaf follwoing stuff:
> 1. Decanter rest-collector
> 2. Decanter rest-servlet-collector
> 
> all Transport is by Default on localhost and port 8181
> 
> *now i'm getting at the Client Karaf follwing Warn-LOG:*
> WARN [EventAdminThread #11] Error sending event to rest service
> java.io.IOException: Server returned HTTP response code: 403 for URL:
> http://localhost:8181
>        at
> sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1900)
> ~[?:1.8.0_242]
>        at
> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
> ~[?:1.8.0_242]
>        at
> org.apache.karaf.decanter.appender.rest.RestAppender.handleEvent(RestAppender.java:93)
> [!/:?]
>        at
> org.apache.felix.eventadmin.impl.handler.EventHandlerProxy.sendEvent(EventHandlerProxy.java:415)
> [!/:?]
>        at
> org.apache.felix.eventadmin.impl.tasks.HandlerTask.run(HandlerTask.java:70)
> [!/:?]
>        at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
> [?:1.8.0_242]
>        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> [?:1.8.0_242]
>        at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> [?:1.8.0_242]
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> [?:1.8.0_242]
>        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_242]
> 
> *and the Server-Karaf is throwing following Warn-Message*
> WARN [Karaf_Worker-3] Can't request REST service
> java.io.FileNotFoundException: http://localhost:8181/metrics
>        at
> sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1896)
> ~[?:1.8.0_242]
>        at
> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
> ~[?:1.8.0_242]
>        at
> org.apache.karaf.decanter.collector.rest.RestCollector.run(RestCollector.java:97)
> [!/:?]
>        at
> org.apache.karaf.scheduler.core.QuartzJobExecutor.execute(QuartzJobExecutor.java:60)
> [!/:?]
>        at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [!/:?]
>        at
> org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
> [!/:?]
> 
> 
> Where i have to adjust some diffenrent configurations to solve this
> Problem????
> 
> thanks for your helpful answers 
> dzoni
> 
> 
> 
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-Dev-f930721.html


Re: REST-Appender-Collector

Posted by Jean-Baptiste Onofre <jb...@nanthrax.net>.
Yeah, your use case makes sense and I did the rest collector/appender for that ;)

Regards
JB

> Le 30 mars 2020 à 14:49, dzoni <ch...@zf.com> a écrit :
> 
> nice this is my target to get the data at the end of the day to my
> elasticsearch cluster
> 
> but in my next step i have to Transport the data to one Server more.
> 
> i'll check out how this will work
> 
> so
> karaf1=log-Collection --> karaf2-Server --> Karaf3-Server --> ElastisSearch
> --> Kibana
> 
> 
> 
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-Dev-f930721.html


Re: REST-Appender-Collector

Posted by dzoni <ch...@zf.com>.
nice this is my target to get the data at the end of the day to my
elasticsearch cluster

but in my next step i have to Transport the data to one Server more.

i'll check out how this will work

so
karaf1=log-Collection --> karaf2-Server --> Karaf3-Server --> ElastisSearch
--> Kibana



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-Dev-f930721.html

Re: REST-Appender-Collector

Posted by Francois Papon <fr...@openobject.fr>.
Hi,

Considering you have instance A as client and intance B as master for collecting all the cluster logs.

You have to configure your instances like this:

Instance A:

collector-log
appender-rest => pull POST message to http://ip-instance-B:8181/decanter/collect

Instance B:
collector-rest-servlet => publish to http://ip-instance-B:8181/decanter/collect

and then you can add some storage appender in Instance B to pull data to ElasticSearch, Cassandra...

regards,

François
fpapon@apache.org

Le 30/03/2020 à 12:42, dzoni a écrit :
> thank u very much for ur fast answers
>
> ok i changed now the config-file like this
>
> *org.apache.karaf.decanter.collector.rest-1.cfg*
> url=http://localhost:8181
> paths=decanter/collect
>
> *org.apache.karaf.decanter.appender.rest.cfg*
> uri=http://localhost:8181/decanter/collect
>
> the Server-Side don't show any warn-messges more
>
> but on the Client side i'm getting now following warns:
> Can't request REST service
> java.io.IOException: Server returned HTTP response code: 405 for URL:
> http://localhost:8181/decanter/collect
>         at
> sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1900)
> ~[?:1.8.0_242]
>         at
> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
> ~[?:1.8.0_242]
>         at
> org.apache.karaf.decanter.collector.rest.RestCollector.run(RestCollector.java:97)
> [!/:?]
>         at
> org.apache.karaf.scheduler.core.QuartzJobExecutor.execute(QuartzJobExecutor.java:60)
> [!/:?]
>         at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [!/:?]
>         at
> org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
> [!/:?]
>
>
> thanks for response
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-Dev-f930721.html

Re: REST-Appender-Collector

Posted by Jean-Baptiste Onofre <jb...@nanthrax.net>.
By the way, in my example I used Decanter 2.3.0-SNAPSHOT (because I’m preparing the release), but Decanter 2.2.0 also works fine ;)

Regards
JB

> Le 30 mars 2020 à 13:47, Jean-Baptiste Onofre <jb...@nanthrax.net> a écrit :
> 
> See my previous email with all steps I did.
> 
> Just: karaf client and karaf server use different http port (changed in etc/org.ops4j.pax.web.cfg) ? Else, you will have issue ;)
> I bet you forgot to change etc/org.ops4j.pax.web.cfg in two instances. In my example, karaf1 uses 8181 and karaf2 8282.
> 
> If you do as I explained in my previous email it should work out of the box. I just did it successfully.
> 
> Regards
> JB
> 
>> Le 30 mars 2020 à 13:45, dzoni <ch...@zf.com> a écrit :
>> 
>> thanks a lot for ur time jbonofre
>> /
>> Do you use json marshaller on both collector and appender ?  /
>> yes see the futher informations down in the bündle list. but there are also
>> csv and raw Marshaller!
>> 
>> /What collectors are you using ? /
>> Client-Side
>> 1. log-collector
>> 2. rest Appender
>> 
>> Server-side
>> 1. rest-collector
>> 2. rest-servlet-collector
>> 
>> /And both rest appender/collector are on the same karaf instance (localhost)
>> ?/
>> No i'm running one Client and one Server Karaf instance to simulate the
>> log-Transport from a Client to a server
>> 
>> *this are my bundles on the Client side*
>> START LEVEL 100 , List Threshold: 50
>> ID | State     | Lvl | Version        | Name
>> ---+-----------+-----+----------------+-----------------------------------------------------------------------------------------------
>> 22 | Active    |  80 | 4.2.8          | Apache Karaf :: OSGi Services ::
>> Event
>> 45 | Active    |  80 | 2.2.0          | Apache Karaf :: Decanter :: API
>> 46 | Active    |  80 | 2.2.0          | Apache Karaf :: Decanter ::
>> Collector :: Log
>> 47 | Active    |  80 | 2.2.0          | Apache Karaf :: Decanter ::
>> Marshaller :: CSV
>> 48 | Active    |  80 | 2.2.0          | Apache Karaf :: Decanter ::
>> Marshaller :: Json
>> 49 | Active    |  80 | 2.2.0          | Apache Karaf :: Decanter ::
>> Marshaller :: Raw
>> 50 | Active    |  80 | 2.2.0          | Apache Karaf :: Decanter :: Parser
>> :: Identity
>> 51 | Active    |  80 | 2.2.0          | Apache Karaf :: Decanter :: Parser
>> :: Regex
>> 52 | Active    |  80 | 2.2.0          | Apache Karaf :: Decanter :: Parser
>> :: Split
>> 55 | Active    |  80 | 1.0.4          | JSR 353 (JSON Processing) Default
>> Provider
>> 58 | Active    |  80 | 2.2.0          | Apache Karaf :: Decanter :: Appender
>> :: REST
>> 
>> *on the Server side i'm running following bundles:*
>> START LEVEL 100 , List Threshold: 50
>> ID | State  | Lvl | Version | Name
>> ----+--------+-----+---------+--------------------------------------------------------------------------------------------------------
>> 22 | Active |  80 | 4.2.8   | Apache Karaf :: OSGi Services :: Event
>> 45 | Active |  80 | 2.2.0   | Apache Karaf :: Decanter :: API
>> 46 | Active |  80 | 2.2.0   | Apache Karaf :: Decanter :: Collector :: REST
>> 47 | Active |  80 | 2.2.0   | Apache Karaf :: Decanter :: Marshaller :: CSV
>> 48 | Active |  80 | 2.2.0   | Apache Karaf :: Decanter :: Marshaller ::
>> Json
>> 49 | Active |  80 | 2.2.0   | Apache Karaf :: Decanter :: Marshaller :: Raw
>> 50 | Active |  80 | 2.2.0   | Apache Karaf :: Decanter :: Parser ::
>> Identity
>> 51 | Active |  80 | 2.2.0   | Apache Karaf :: Decanter :: Parser :: Regex
>> 52 | Active |  80 | 2.2.0   | Apache Karaf :: Decanter :: Parser :: Split
>> 56 | Active |  80 | 1.0.4   | JSR 353 (JSON Processing) Default Provider
>> 66 | Active |  80 | 2.2.0   | Apache Karaf :: Decanter :: Collector :: REST
>> :: Servlet
>> 68 | Active |  80 | 4.14.0  | Apache XBean OSGI Bundle Utilities
>> 69 | Active |  80 | 4.14.0  | Apache XBean :: Classpath Resource Finder
>> 98 | Active |  80 | 7.2.0   | org.objectweb.asm
>> 99 | Active |  80 | 7.2.0   | org.objectweb.asm.commons
>> 100 | Active |  80 | 7.2.0   | org.objectweb.asm.tree
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> --
>> Sent from: http://karaf.922171.n3.nabble.com/Karaf-Dev-f930721.html
> 


Re: REST-Appender-Collector

Posted by Jean-Baptiste Onofre <jb...@nanthrax.net>.
See my previous email with all steps I did.

Just: karaf client and karaf server use different http port (changed in etc/org.ops4j.pax.web.cfg) ? Else, you will have issue ;)
I bet you forgot to change etc/org.ops4j.pax.web.cfg in two instances. In my example, karaf1 uses 8181 and karaf2 8282.

If you do as I explained in my previous email it should work out of the box. I just did it successfully.

Regards
JB

> Le 30 mars 2020 à 13:45, dzoni <ch...@zf.com> a écrit :
> 
> thanks a lot for ur time jbonofre
> /
> Do you use json marshaller on both collector and appender ?  /
> yes see the futher informations down in the bündle list. but there are also
> csv and raw Marshaller!
> 
> /What collectors are you using ? /
> Client-Side
> 1. log-collector
> 2. rest Appender
> 
> Server-side
> 1. rest-collector
> 2. rest-servlet-collector
> 
> /And both rest appender/collector are on the same karaf instance (localhost)
> ?/
> No i'm running one Client and one Server Karaf instance to simulate the
> log-Transport from a Client to a server
> 
> *this are my bundles on the Client side*
> START LEVEL 100 , List Threshold: 50
> ID | State     | Lvl | Version        | Name
> ---+-----------+-----+----------------+-----------------------------------------------------------------------------------------------
> 22 | Active    |  80 | 4.2.8          | Apache Karaf :: OSGi Services ::
> Event
> 45 | Active    |  80 | 2.2.0          | Apache Karaf :: Decanter :: API
> 46 | Active    |  80 | 2.2.0          | Apache Karaf :: Decanter ::
> Collector :: Log
> 47 | Active    |  80 | 2.2.0          | Apache Karaf :: Decanter ::
> Marshaller :: CSV
> 48 | Active    |  80 | 2.2.0          | Apache Karaf :: Decanter ::
> Marshaller :: Json
> 49 | Active    |  80 | 2.2.0          | Apache Karaf :: Decanter ::
> Marshaller :: Raw
> 50 | Active    |  80 | 2.2.0          | Apache Karaf :: Decanter :: Parser
> :: Identity
> 51 | Active    |  80 | 2.2.0          | Apache Karaf :: Decanter :: Parser
> :: Regex
> 52 | Active    |  80 | 2.2.0          | Apache Karaf :: Decanter :: Parser
> :: Split
> 55 | Active    |  80 | 1.0.4          | JSR 353 (JSON Processing) Default
> Provider
> 58 | Active    |  80 | 2.2.0          | Apache Karaf :: Decanter :: Appender
> :: REST
> 
> *on the Server side i'm running following bundles:*
> START LEVEL 100 , List Threshold: 50
> ID | State  | Lvl | Version | Name
> ----+--------+-----+---------+--------------------------------------------------------------------------------------------------------
> 22 | Active |  80 | 4.2.8   | Apache Karaf :: OSGi Services :: Event
> 45 | Active |  80 | 2.2.0   | Apache Karaf :: Decanter :: API
> 46 | Active |  80 | 2.2.0   | Apache Karaf :: Decanter :: Collector :: REST
> 47 | Active |  80 | 2.2.0   | Apache Karaf :: Decanter :: Marshaller :: CSV
> 48 | Active |  80 | 2.2.0   | Apache Karaf :: Decanter :: Marshaller ::
> Json
> 49 | Active |  80 | 2.2.0   | Apache Karaf :: Decanter :: Marshaller :: Raw
> 50 | Active |  80 | 2.2.0   | Apache Karaf :: Decanter :: Parser ::
> Identity
> 51 | Active |  80 | 2.2.0   | Apache Karaf :: Decanter :: Parser :: Regex
> 52 | Active |  80 | 2.2.0   | Apache Karaf :: Decanter :: Parser :: Split
> 56 | Active |  80 | 1.0.4   | JSR 353 (JSON Processing) Default Provider
> 66 | Active |  80 | 2.2.0   | Apache Karaf :: Decanter :: Collector :: REST
> :: Servlet
> 68 | Active |  80 | 4.14.0  | Apache XBean OSGI Bundle Utilities
> 69 | Active |  80 | 4.14.0  | Apache XBean :: Classpath Resource Finder
> 98 | Active |  80 | 7.2.0   | org.objectweb.asm
> 99 | Active |  80 | 7.2.0   | org.objectweb.asm.commons
> 100 | Active |  80 | 7.2.0   | org.objectweb.asm.tree
> 
> 
> 
> 
> 
> 
> 
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-Dev-f930721.html


Re: REST-Appender-Collector

Posted by dzoni <ch...@zf.com>.
thanks a lot for ur time jbonofre
/
Do you use json marshaller on both collector and appender ?  /
yes see the futher informations down in the bündle list. but there are also
csv and raw Marshaller!

/What collectors are you using ? /
Client-Side
1. log-collector
2. rest Appender

Server-side
1. rest-collector
2. rest-servlet-collector

/And both rest appender/collector are on the same karaf instance (localhost)
?/
No i'm running one Client and one Server Karaf instance to simulate the
log-Transport from a Client to a server

*this are my bundles on the Client side*
START LEVEL 100 , List Threshold: 50
ID | State     | Lvl | Version        | Name
---+-----------+-----+----------------+-----------------------------------------------------------------------------------------------
22 | Active    |  80 | 4.2.8          | Apache Karaf :: OSGi Services ::
Event
45 | Active    |  80 | 2.2.0          | Apache Karaf :: Decanter :: API
46 | Active    |  80 | 2.2.0          | Apache Karaf :: Decanter ::
Collector :: Log
47 | Active    |  80 | 2.2.0          | Apache Karaf :: Decanter ::
Marshaller :: CSV
48 | Active    |  80 | 2.2.0          | Apache Karaf :: Decanter ::
Marshaller :: Json
49 | Active    |  80 | 2.2.0          | Apache Karaf :: Decanter ::
Marshaller :: Raw
50 | Active    |  80 | 2.2.0          | Apache Karaf :: Decanter :: Parser
:: Identity
51 | Active    |  80 | 2.2.0          | Apache Karaf :: Decanter :: Parser
:: Regex
52 | Active    |  80 | 2.2.0          | Apache Karaf :: Decanter :: Parser
:: Split
55 | Active    |  80 | 1.0.4          | JSR 353 (JSON Processing) Default
Provider
58 | Active    |  80 | 2.2.0          | Apache Karaf :: Decanter :: Appender
:: REST

*on the Server side i'm running following bundles:*
START LEVEL 100 , List Threshold: 50
 ID | State  | Lvl | Version | Name
----+--------+-----+---------+--------------------------------------------------------------------------------------------------------
 22 | Active |  80 | 4.2.8   | Apache Karaf :: OSGi Services :: Event
 45 | Active |  80 | 2.2.0   | Apache Karaf :: Decanter :: API
 46 | Active |  80 | 2.2.0   | Apache Karaf :: Decanter :: Collector :: REST
 47 | Active |  80 | 2.2.0   | Apache Karaf :: Decanter :: Marshaller :: CSV
 48 | Active |  80 | 2.2.0   | Apache Karaf :: Decanter :: Marshaller ::
Json
 49 | Active |  80 | 2.2.0   | Apache Karaf :: Decanter :: Marshaller :: Raw
 50 | Active |  80 | 2.2.0   | Apache Karaf :: Decanter :: Parser ::
Identity
 51 | Active |  80 | 2.2.0   | Apache Karaf :: Decanter :: Parser :: Regex
 52 | Active |  80 | 2.2.0   | Apache Karaf :: Decanter :: Parser :: Split
 56 | Active |  80 | 1.0.4   | JSR 353 (JSON Processing) Default Provider
 66 | Active |  80 | 2.2.0   | Apache Karaf :: Decanter :: Collector :: REST
:: Servlet
 68 | Active |  80 | 4.14.0  | Apache XBean OSGI Bundle Utilities
 69 | Active |  80 | 4.14.0  | Apache XBean :: Classpath Resource Finder
 98 | Active |  80 | 7.2.0   | org.objectweb.asm
 99 | Active |  80 | 7.2.0   | org.objectweb.asm.commons
100 | Active |  80 | 7.2.0   | org.objectweb.asm.tree







--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-Dev-f930721.html

Re: REST-Appender-Collector

Posted by Jean-Baptiste Onofre <jb...@nanthrax.net>.
Do you use json marshaller on both collector and appender ? 

What collectors are you using ?

And both rest appender/collector are on the same karaf instance (localhost) ?

Let me try a new test (I did it this morning).

Regards
JB

> Le 30 mars 2020 à 12:42, dzoni <ch...@zf.com> a écrit :
> 
> thank u very much for ur fast answers
> 
> ok i changed now the config-file like this
> 
> *org.apache.karaf.decanter.collector.rest-1.cfg*
> url=http://localhost:8181
> paths=decanter/collect
> 
> *org.apache.karaf.decanter.appender.rest.cfg*
> uri=http://localhost:8181/decanter/collect
> 
> the Server-Side don't show any warn-messges more
> 
> but on the Client side i'm getting now following warns:
> Can't request REST service
> java.io.IOException: Server returned HTTP response code: 405 for URL:
> http://localhost:8181/decanter/collect
>        at
> sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1900)
> ~[?:1.8.0_242]
>        at
> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
> ~[?:1.8.0_242]
>        at
> org.apache.karaf.decanter.collector.rest.RestCollector.run(RestCollector.java:97)
> [!/:?]
>        at
> org.apache.karaf.scheduler.core.QuartzJobExecutor.execute(QuartzJobExecutor.java:60)
> [!/:?]
>        at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [!/:?]
>        at
> org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
> [!/:?]
> 
> 
> thanks for response
> 
> 
> 
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-Dev-f930721.html


Re: REST-Appender-Collector

Posted by Jean-Baptiste Onofre <jb...@nanthrax.net>.
Cool, so, you are good to me ;)

Decanter 2.2.0 also works fine.

FYI, I plan to submit Decanter 2.3.0 to vote today.

Regards
JB

> Le 30 mars 2020 à 14:52, dzoni <ch...@zf.com> a écrit :
> 
> very nice thank u alot
> 
> i tried it out with the step u descriped and i received the jmx Messages on
> the server-karaf
> 
> i tried it out with the 2.3.0-Snapshot version
> 
> later i will have a new try with the way i failed bevor
> 
> thank u very much till now for ur time and ur help
> 
> i'm happy to got in contact with u
> thanks alot
> 
> 
> 
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-Dev-f930721.html


Re: REST-Appender-Collector

Posted by dzoni <ch...@zf.com>.
very nice thank u alot

i tried it out with the step u descriped and i received the jmx Messages on
the server-karaf

i tried it out with the 2.3.0-Snapshot version

later i will have a new try with the way i failed bevor

thank u very much till now for ur time and ur help

i'm happy to got in contact with u
thanks alot



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-Dev-f930721.html

Re: REST-Appender-Collector

Posted by Jean-Baptiste Onofre <jb...@nanthrax.net>.
Here’s what I did:

- on karaf1, I installed:

	feature:repo-add decanter 2.3.0-SNAPSHOT
	feature:install decanter-collector-rest-servlet
	feature:install decanter-appender-log

	I can see the collector rest servlet bound using http:list command.

- on karaf2, I installed:

	feature:repo-add decanter 2.3.0-SNAPSHOT
	feature:install decanter-appender-rest
	
	I changed the configuration in etc/org.apache.karaf.decanter.appender.rest.cfg to put:
	uri=http://localhost:8181/decanter/collector <http://localhost:8181/decanter/collector>

	Then I installed log and jmx collector on karaf2:

	feature:install decanter-collector-log
	feature:install decanter-collector-jmx

And I can see in the karaf1 log:

13:43:10.071 INFO [EventAdminAsyncThread #21] {"@timestamp":"2020-03-30T11:43:10,068Z","hostName":"LT-C02R90TRG8WM","felix_fileinstall_filename":"file:/Users/jbonofre/Downloads/node1/etc/org.apache.karaf.decanter.collector.rest.servlet.cfg","unmarshaller_target":"(dataFormat=json)","type":"restservlet","MDC":{"bundle_id":"10","bundle_name":"org.apache.felix.fileinstall","bundle_version":"3.6.4"},"decanter_collector_name":"rest-servlet","component_id":10,"payload":"{\"@timestamp\":\"2020-03-30T11:43:10,068Z\",\"hostName\":\"LT-C02R90TRG8WM\",\"loc_class\":\"org.apache.felix.fileinstall.internal.Util$OsgiLogger\",\"component_name\":\"org.apache.karaf.decanter.collector.log\",\"level\":\"INFO\",\"type\":\"log\",\"message\":\"Creating configuration from org.apache.karaf.decanter.collector.log.cfg\",\"MDC\":{\"bundle_id\":\"10\",\"bundle_version\":\"3.6.4\",\"bundle_name\":\"org.apache.felix.fileinstall\"},\"threadName\":\"fileinstall-/Users/jbonofre/Downloads/node2/etc\",\"loc_method\":\"log\",\"loc_file\":\"Util.java\",\"component_id\":10,\"karafName\":\"root\",\"name\":\"log\",\"org_ops4j_pax_logging_appender_name\":\"DecanterLogCollectorAppender\",\"hostAddress\":\"192.168.0.11\",\"loggerName\":\"org.apache.felix.fileinstall\",\"loggerClass\":\"org.ops4j.pax.logging.log4j2.internal.PaxLoggingServiceImpl$1ManagedPaxLoggingService\",\"renderedMessage\":\"Creating configuration from org.apache.karaf.decanter.collector.log.cfg\",\"timestamp\":1585568590068,\"loc_line\":\"205\",\"event_topics\":\"decanter/collect/log/org_apache_felix_fileinstall\"}","karafName":"root","alias":"/decanter/collect","loggerName":"org.apache.felix.fileinstall","timestamp":1585568590068,"component_name":"org.apache.karaf.decanter.collector.log","level":"INFO","message":"Creating configuration from org.apache.karaf.decanter.collector.log.cfg","threadName":"fileinstall-/Users/jbonofre/Downloads/node2/etc","service_pid":"org.apache.karaf.decanter.collector.rest.servlet","org_ops4j_pax_logging_appender_name":"DecanterLogCollectorAppender","loc_method":"log","event_topics":"decanter/collect/rest-servlet","loc_class":"org.apache.felix.fileinstall.internal.Util$OsgiLogger","loc_file":"Util.java","name":"log","hostAddress":"192.168.0.11","loc_line":"205","loggerClass":"org.ops4j.pax.logging.log4j2.internal.PaxLoggingServiceImpl$1ManagedPaxLoggingService","renderedMessage":"Creating configuration from org.apache.karaf.decanter.collector.log.cfg"}

So it works just fine.

NB: my two karaf instances is running on the same machine. I just change the ports in etc/org.apache.karaf.shell.cfg, etc/org.apache.karaf.management.cfg and etc/org.ops4j.pax.web.cfg

Regards
JB

> Le 30 mars 2020 à 12:42, dzoni <ch...@zf.com> a écrit :
> 
> thank u very much for ur fast answers
> 
> ok i changed now the config-file like this
> 
> *org.apache.karaf.decanter.collector.rest-1.cfg*
> url=http://localhost:8181
> paths=decanter/collect
> 
> *org.apache.karaf.decanter.appender.rest.cfg*
> uri=http://localhost:8181/decanter/collect
> 
> the Server-Side don't show any warn-messges more
> 
> but on the Client side i'm getting now following warns:
> Can't request REST service
> java.io.IOException: Server returned HTTP response code: 405 for URL:
> http://localhost:8181/decanter/collect
>        at
> sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1900)
> ~[?:1.8.0_242]
>        at
> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
> ~[?:1.8.0_242]
>        at
> org.apache.karaf.decanter.collector.rest.RestCollector.run(RestCollector.java:97)
> [!/:?]
>        at
> org.apache.karaf.scheduler.core.QuartzJobExecutor.execute(QuartzJobExecutor.java:60)
> [!/:?]
>        at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [!/:?]
>        at
> org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
> [!/:?]
> 
> 
> thanks for response
> 
> 
> 
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-Dev-f930721.html


Re: REST-Appender-Collector

Posted by dzoni <ch...@zf.com>.
thank u very much for ur fast answers

ok i changed now the config-file like this

*org.apache.karaf.decanter.collector.rest-1.cfg*
url=http://localhost:8181
paths=decanter/collect

*org.apache.karaf.decanter.appender.rest.cfg*
uri=http://localhost:8181/decanter/collect

the Server-Side don't show any warn-messges more

but on the Client side i'm getting now following warns:
Can't request REST service
java.io.IOException: Server returned HTTP response code: 405 for URL:
http://localhost:8181/decanter/collect
        at
sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1900)
~[?:1.8.0_242]
        at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
~[?:1.8.0_242]
        at
org.apache.karaf.decanter.collector.rest.RestCollector.run(RestCollector.java:97)
[!/:?]
        at
org.apache.karaf.scheduler.core.QuartzJobExecutor.execute(QuartzJobExecutor.java:60)
[!/:?]
        at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [!/:?]
        at
org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
[!/:?]


thanks for response



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-Dev-f930721.html

Re: REST-Appender-Collector

Posted by Jean-Baptiste Onofre <jb...@nanthrax.net>.
I think the uri is empty in etc/org.apache.karaf.decanter.appender.rest.cfg, you have to define it as explained in the documentation.

Regards
JB

> Le 30 mars 2020 à 11:16, dzoni <ch...@zf.com> a écrit :
> 
> Hello there,
> 
> i'm Building up an infrastructure example for transporting log-Messages to a
> target.
> 
> In my Case im running in one Karaf (client):
> 1. my application
> 2. Decanter log-collector
> 3. Decanter rest-Appender
> 
> there i want the collected data to send into another Karaf (server),
> therefor i'm running in the other Karaf follwoing stuff:
> 1. Decanter rest-collector
> 2. Decanter rest-servlet-collector
> 
> all Transport is by Default on localhost and port 8181
> 
> *now i'm getting at the Client Karaf follwing Warn-LOG:*
> WARN [EventAdminThread #11] Error sending event to rest service
> java.io.IOException: Server returned HTTP response code: 403 for URL:
> http://localhost:8181
>        at
> sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1900)
> ~[?:1.8.0_242]
>        at
> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
> ~[?:1.8.0_242]
>        at
> org.apache.karaf.decanter.appender.rest.RestAppender.handleEvent(RestAppender.java:93)
> [!/:?]
>        at
> org.apache.felix.eventadmin.impl.handler.EventHandlerProxy.sendEvent(EventHandlerProxy.java:415)
> [!/:?]
>        at
> org.apache.felix.eventadmin.impl.tasks.HandlerTask.run(HandlerTask.java:70)
> [!/:?]
>        at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
> [?:1.8.0_242]
>        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> [?:1.8.0_242]
>        at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> [?:1.8.0_242]
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> [?:1.8.0_242]
>        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_242]
> 
> *and the Server-Karaf is throwing following Warn-Message*
> WARN [Karaf_Worker-3] Can't request REST service
> java.io.FileNotFoundException: http://localhost:8181/metrics
>        at
> sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1896)
> ~[?:1.8.0_242]
>        at
> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
> ~[?:1.8.0_242]
>        at
> org.apache.karaf.decanter.collector.rest.RestCollector.run(RestCollector.java:97)
> [!/:?]
>        at
> org.apache.karaf.scheduler.core.QuartzJobExecutor.execute(QuartzJobExecutor.java:60)
> [!/:?]
>        at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [!/:?]
>        at
> org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
> [!/:?]
> 
> 
> Where i have to adjust some diffenrent configurations to solve this
> Problem????
> 
> thanks for your helpful answers 
> dzoni
> 
> 
> 
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-Dev-f930721.html