sipcapture / HEPop

Multi-Protocol HEP Server & RTC Collector in NodeJS :balloon:
http://sipcapture.io
GNU Affero General Public License v3.0
22 stars 11 forks source link

No data displayed in homer UI #24

Closed NinoFares closed 4 years ago

NinoFares commented 4 years ago

Hi guys,

i am using HEpop to capture Janus Events, my events are well stored in my database. But when i try to see them in homer UI, a unknown error occurs :

image

Thats what my api shows me :

echo: http: panic serving 10.11.91.40:43214: interface conversion: interface {} │ app[10978]: goroutine 368 [running]: │ app[10978]: net/http.(*conn).serve.func1(0xc0001f6640) │ app[10978]: #011/usr/local/go/src/net/http/server.go:1767 +0x139 │ app[10978]: panic(0xcd5880, 0xc0004efe30) │ app[10978]: #011/usr/local/go/src/runtime/panic.go:679 +0x1b2 │ app[10978]: github.com/sipcapture/homer-app/data/service.(*SearchService).SearchData(0xc0003│ app[10978]: #011/home/shurik/go/src/github.com/sipcapture/homer-app/data/service/search.go:2│ app[10978]: github.com/sipcapture/homer-app/controller/v1.(*SearchController).SearchData(0xc│ app[10978]: #011/home/shurik/go/src/github.com/sipcapture/homer-app/controller/v1/search.go:│ app[10978]: github.com/sipcapture/homer-app/auth.MiddlewareRes.func1(0xf53b40, 0xc0000fc070,│ app[10978]: #011/home/shurik/go/src/github.com/sipcapture/homer-app/auth/middleware.go:24 +0│ app[10978]: github.com/labstack/echo/v4/middleware.JWTWithConfig.func2.1(0xf53b40, 0xc0000fc│ app[10978]: #011/home/shurik/go/pkg/mod/github.com/labstack/echo/v4@v4.0.0/middleware/jwt.go│ app[10978]: github.com/labstack/echo/v4.(*Echo).Add.func1(0xf53b40, 0xc0000fc070, 0xffffffff│ app[10978]: #011/home/shurik/go/pkg/mod/github.com/labstack/echo/v4@v4.0.0/echo.go:490 +0x8a│ app[10978]: github.com/labstack/echo/v4/middleware.GzipWithConfig.func1.1(0xf53b40, 0xc0000f│ app[10978]: #011/home/shurik/go/pkg/mod/github.com/labstack/echo/v4@v4.0.0/middleware/compre│ app[10978]: github.com/labstack/echo/v4/middleware.StaticWithConfig.func1.1(0xf53b40, 0xc000│ app[10978]: #011/home/shurik/go/pkg/mod/github.com/labstack/echo/v4@v4.0.0/middleware/static│ app[10978]: github.com/labstack/echo/v4/middleware.CORSWithConfig.func1.1(0xf53b40, 0xc0000f│ app[10978]: #011/home/shurik/go/pkg/mod/github.com/labstack/echo/v4@v4.0.0/middleware/cors.g│ app[10978]: github.com/labstack/echo/v4.(*Echo).ServeHTTP.func1(0xf53b40, 0xc0000fc070, 0xc0│ app[10978]: #011/home/shurik/go/pkg/mod/github.com/labstack/echo/v4@v4.0.0/echo.go:585 +0x10│ app[10978]: github.com/labstack/echo/v4/middleware.RewriteWithConfig.func1.1(0xf53b40, 0xc00│ app[10978]: #011/home/shurik/go/pkg/mod/github.com/labstack/echo/v4@v4.0.0/middleware/rewrit│ app[10978]: github.com/labstack/echo/v4.(*Echo).ServeHTTP(0xc00000a1e0, 0xf37420, 0xc0000c80│ app[10978]: #011/home/shurik/go/pkg/mod/github.com/labstack/echo/v4@v4.0.0/echo.go:593 +0x22│ app[10978]: net/http.serverHandler.ServeHTTP(0xc0000c81c0, 0xf37420, 0xc0000c80e0, 0xc00016c│ app[10978]: #011/usr/local/go/src/net/http/server.go:2802 +0xa4 │ app[10978]: net/http.(*conn).serve(0xc0001f6640, 0xf3a560, 0xc00027a000) │ app[10978]: #011/usr/local/go/src/net/http/server.go:1890 +0x875 │ app[10978]: created by net/http.(*Server).Serve │ app[10978]: #011/usr/local/go/src/net/http/server.go:2928 +0x384

Need help please !

lmangani commented 4 years ago

Great! we needed some help to tweak and fix things for Janus events. Could you detail your setup and configuration please?

lmangani commented 4 years ago

@NinoFares could you also attach a sample insert from the table?

adubovikov commented 4 years ago

and please provide full log, looks lke the current one is cuted off

NinoFares commented 4 years ago

Yes of course,

So my config of HEpop : { "id" : "HEPop101", "socket": "http", "port": 8080, "address": "0.0.0.0", "queue": { "timeout": 2000, "maxSize": 1000, "useInterval": true }, "db": { "rawSize": 8000, "pgsql":{ "host": "localhost", "port": 5432, "user": "homer_user", "password": "homer_password" } }, "debug": false }

Full log error of api : echo: http: panic serving 10.11.91.40:44152: interface conversion: interface {} is nil, not string goroutine 27 [running]: net/http.(*conn).serve.func1(0xc000096c80) /usr/local/go/src/net/http/server.go:1767 +0x139 panic(0xcd5880, 0xc000429da0) /usr/local/go/src/runtime/panic.go:679 +0x1b2 github.com/sipcapture/homer-app/data/service.(*SearchService).SearchData(0xc0003e10e0, 0xc000068960, 0xc0002412f8, 0x0, 0x0, 0x0, 0x5eda9f7f55ff13ce) /home/shurik/go/src/github.com/sipcapture/homer-app/data/service/search.go:217 +0x2314 github.com/sipcapture/homer-app/controller/v1.(*SearchController).SearchData(0xc0003cf460, 0xf53d00, 0xc00012bec0, 0xc00012bec0, 0xdc0760) /home/shurik/go/src/github.com/sipcapture/homer-app/controller/v1/search.go:65 +0x2cd github.com/sipcapture/homer-app/auth.MiddlewareRes.func1(0xf53b40, 0xc0003ead20, 0x4, 0xcd1280) /home/shurik/go/src/github.com/sipcapture/homer-app/auth/middleware.go:24 +0x1eb github.com/labstack/echo/v4/middleware.JWTWithConfig.func2.1(0xf53b40, 0xc0003ead20, 0xc00003a7e5, 0xdd1800) /home/shurik/go/pkg/mod/github.com/labstack/echo/v4@v4.0.0/middleware/jwt.go:181 +0x2ff github.com/labstack/echo/v4.(*Echo).Add.func1(0xf53b40, 0xc0003ead20, 0xffffffffffffff01, 0xc000084770) /home/shurik/go/pkg/mod/github.com/labstack/echo/v4@v4.0.0/echo.go:490 +0x8a github.com/labstack/echo/v4/middleware.GzipWithConfig.func1.1(0xf53b40, 0xc0003ead20, 0x0, 0x0) /home/shurik/go/pkg/mod/github.com/labstack/echo/v4@v4.0.0/middleware/compress.go:64 +0x584 github.com/labstack/echo/v4/middleware.StaticWithConfig.func1.1(0xf53b40, 0xc0003ead20, 0xdefd4b, 0x1b) /home/shurik/go/pkg/mod/github.com/labstack/echo/v4@v4.0.0/middleware/static.go:169 +0x2b9 github.com/labstack/echo/v4/middleware.CORSWithConfig.func1.1(0xf53b40, 0xc0003ead20, 0x4, 0xc00003a7e5) /home/shurik/go/pkg/mod/github.com/labstack/echo/v4@v4.0.0/middleware/cors.go:117 +0x407 github.com/labstack/echo/v4.(*Echo).ServeHTTP.func1(0xf53b40, 0xc0003ead20, 0x7f51186b5501, 0x0) /home/shurik/go/pkg/mod/github.com/labstack/echo/v4@v4.0.0/echo.go:585 +0x108 github.com/labstack/echo/v4/middleware.RewriteWithConfig.func1.1(0xf53b40, 0xc0003ead20, 0xc0003ead20, 0xc000084d70) /home/shurik/go/pkg/mod/github.com/labstack/echo/v4@v4.0.0/middleware/rewrite.go:68 +0x1ff github.com/labstack/echo/v4.(*Echo).ServeHTTP(0xc00000a1e0, 0xf37420, 0xc0000ca380, 0xc000170a00) /home/shurik/go/pkg/mod/github.com/labstack/echo/v4@v4.0.0/echo.go:593 +0x222 net/http.serverHandler.ServeHTTP(0xc0000ca1c0, 0xf37420, 0xc0000ca380, 0xc000170a00) /usr/local/go/src/net/http/server.go:2802 +0xa4 net/http.(*conn).serve(0xc000096c80, 0xf3a560, 0xc000073000) /usr/local/go/src/net/http/server.go:1890 +0x875 created by net/http.(*Server).Serve /usr/local/go/src/net/http/server.go:2928 +0x384

aqsyonas commented 4 years ago

@NinoFares could you provide some few records from your database? or dump of your table.

adubovikov commented 4 years ago

this error tells - no records have been returned. Check your time range.

NinoFares commented 4 years ago

i didn't change the time range, so by default it takes "today" and as you can see on my image capture of my database there are data for "today" :

Capture d'écran du 2020-04-29 14 39 14

lmangani commented 4 years ago

Thanks for the details - Perhaps you could paste the API query and response of your request?

NinoFares commented 4 years ago

Yes,

image

image

As you can see, there is no response, because of the api error.

adubovikov commented 4 years ago

can you please activate debug in the homer-app and see if it does a correct query to the correct table ? Also, please send us the sql dump of that table ?

lmangani commented 4 years ago

1000_default is probably the issue here, checking... no its correct

 insert.protocol_header.payloadType = 1000; 
 var key = ( insert.protocol_header.payloadType ) + "_"+ (insert.protocol_header.type || "default");
NinoFares commented 4 years ago

Sorry i can't dump my table, i have some problem with postgresql_client and some dependences. but after some research on code i found that the probleme is in :

github.com/sipcapture/homer-app/data/service.(*SearchService).SearchData(0xc0003e10e0, 0xc0003920c0, 0xc00036f2f8, 0x0, 0x0, 0x0, 0x5eda9f7f55ff13ce) /home/shurik/go/src/github.com/sipcapture/homer-app/data/service/search.go:217 +0x2314 github.com/sipcapture/homer-app/controller/v1.(*SearchController).SearchData(0xc0003cf460, 0xf53d00, 0xc000614360, 0xc000614360, 0xdc0760) /home/shurik/go/src/github.com/sipcapture/homer-app/controller/v1/search.go:65 +0x2cd github.com/sipcapture/homer-app/auth.MiddlewareRes.func1(0xf53b40, 0xc0000f8000, 0x4, 0xcd1280)

so it's in line of data/service/search.go :

srcIPPort := dataElement.S("srcIp").Data().(string) + ":" + strconv.FormatFloat(dataElement.S("srcPort").Data().(float64), 'f', 0, 64) dstIPPort := dataElement.S("dstIp").Data().(string) + ":" + strconv.FormatFloat(dataElement.S("dstPort").Data().(float64), 'f', 0, 64) srcIPPortZero := dataElement.S("srcIp").Data().(string) + ":" + "0" dstIPPortZero := dataElement.S("dstIp").Data().(string) + ":" + "0"

And i don't have dstPort in my data_header of my table (you can see in the image that i sent earlier), what do you think ?

adubovikov commented 4 years ago

https://github.com/sipcapture/homer-app/commit/6eafeef348504ee4dbaadd9d00eebc152b328909

you can download and retest

https://github.com/sipcapture/homer-app/raw/master/homer-app

NinoFares commented 4 years ago

Thanks for your speed, i'll test it now

NinoFares commented 4 years ago

I've had a few other problems, I've just done a fork. i will add all the checks missing and i will do a pull request. Thanks for your help

adubovikov commented 4 years ago

so, works ? Can we close the ticket ?

NinoFares commented 4 years ago

Not working yet, but yes, I think we can close the ticket because we know where the problem is. Thanks guys !

lmangani commented 4 years ago

Thanks @NinoFares let us know how we can help, once again this interaction is crucial to making this feature viable so you have our full support and attention in case patches are needed on either HEPop or Homer-App/UI for this to shine!

NinoFares commented 4 years ago

@lmangani @adubovikov of course, I like your work and you have my full support too.