(Mac) LogMX HTTP Server Not Receiving Logs

Notes, tips, and other usefull things on how to use LogMX

Moderator: admin

Post Reply
philmoc
Posts: 6
Joined: Mon Jun 10, 2019 6:15 pm

(Mac) LogMX HTTP Server Not Receiving Logs

Post by philmoc »

I currently work for High 5 Games, a license holder for LogMX.

I am trying to get myself setup with LogMX on Mac. However, LogMX doesn't seem to be receiving even a simple message sent via curl in Terminal. In the LogMX window, I don't see anything indicating that anything was received. Attached a screenshot of the LogMX window after trying to send the curl message.

I have the following http.server.headers in my managers.properties file:

Code: Select all

http.server.header.Access-Control-Allow-Origin = *
http.server.header.Access-Control-Allow-Headers = Accept, Accept-CH, Accept-Charset, Accept-Datetime, Accept-Encoding, Accept-Ext, Accept-Features, Accept-Language, Accept-Params, Accept-Ranges, Access-Control-Allow-Credentials, Access-Control-Allow-Headers, Access-Control-Allow-Methods, Access-Control-Allow-Origin, Access-Control-Expose-Headers, Access-Control-Max-Age, Access-Control-Request-Headers, Access-Control-Request-Method, Age, Allow, Alternates, Authentication-Info, Authorization, C-Ext, C-Man, C-Opt, C-PEP, C-PEP-Info, CONNECT, Cache-Control, Compliance, Connection, Content-Base, Content-Disposition, Content-Encoding, Content-ID, Content-Language, Content-Length, Content-Location, Content-MD5, Content-Range, Content-Script-Type, Content-Security-Policy, Content-Style-Type, Content-Transfer-Encoding, Content-Type, Content-Version, Cookie, Cost, DAV, DELETE, DNT, DPR, Date, Default-Style, Delta-Base, Depth, Derived-From, Destination, Differential-ID, Digest, ETag, Expect, Expires, Ext, From, GET, GetProfile, HEAD, HTTP-date, Host, IM, If, If-Match, If-Modified-Since, If-None-Match, If-Range, If-Unmodified-Since, Keep-Alive, Label, Last-Event-ID, Last-Modified, Link, Location, Lock-Token, MIME-Version, Man, Max-Forwards, Media-Range, Message-ID, Meter, Negotiate, Non-Compliance, OPTION, OPTIONS, OWS, Opt, Optional, Ordering-Type, Origin, Overwrite, P3P, PEP, PICS-Label, POST, PUT, Pep-Info, Permanent, Position, Pragma, ProfileObject, Protocol, Protocol-Query, Protocol-Request, Proxy-Authenticate, Proxy-Authentication-Info, Proxy-Authorization, Proxy-Features, Proxy-Instruction, Public, RWS, Range, Referer, Refresh, Resolution-Hint, Resolver-Location, Retry-After, Safe, Sec-Websocket-Extensions, Sec-Websocket-Key, Sec-Websocket-Origin, Sec-Websocket-Protocol, Sec-Websocket-Version, Security-Scheme, Server, Set-Cookie, Set-Cookie2, SetProfile, SoapAction, Status, Status-URI, Strict-Transport-Security, SubOK, Subst, Surrogate-Capability, Surrogate-Control, TCN, TE, TRACE, Timeout, Title, Trailer, Transfer-Encoding, UA-Color, UA-Media, UA-Pixels, UA-Resolution, UA-Windowpixels, URI, Upgrade, User-Agent, Variant-Vary, Vary, Version, Via, Viewport-Width, WWW-Authenticate, Want-Digest, Warning, Width, X-Content-Duration, X-Content-Security-Policy, X-Content-Type-Options, X-CustomHeader, X-DNSPrefetch-Control, X-Forwarded-For, X-Forwarded-Port, X-Forwarded-Proto, X-Frame-Options, X-Modified, X-OTHER, X-PING, X-PINGOTHER, X-Powered-By, X-Requested-With
http.server.header.Content-Type = application/json
The curl message I'm trying to send is as follows:

Code: Select all

curl -H "Content-Type: application/json" -X POST -d "[{\"id\":\"1\", \"logger\":\"TestLogger\", \"level\":\"DEBUG\", \"message\":\"Test message\"}]" http://localhost:8080/logmx
Our client architect, Jobe, suggested I try changing the port and also trying my local network IP, but neither seems to help. Let me know if you need any more information than what I've provided.
Attachments
Screen Shot 2019-06-10 at 2.02.16 PM.png
Screen Shot 2019-06-10 at 2.02.16 PM.png (931.05 KiB) Viewed 40530 times
admin
Site Admin
Posts: 555
Joined: Sun Dec 17, 2006 10:30 pm

Re: (Mac) LogMX HTTP Server Not Receiving Logs

Post by admin »

Hello,

I just tried on macOS Mojave (same URL, with curl), and it worked fine. Here are a couple of things you can try:
  1. In the terminal, type: lsof -nP -iTCP:8080 You should see the LogMX process listening on the port 8080. If not, you may encounter some OS network config issue (firewall, network interfaces configuration, ...)
  2. Instead of opening "http-server://*:8080/logmx", you may want to try things like "http-server://127.0.0.1:8080/logmx" or "http-server://localhost:8080/logmx" (may help LogMX in case of some IPv6 conflicts with ::1 for example)
  3. You may want to use another port number just in case you have some special rules for this (commonly used) port. I think that if another app was using this port, LogMX would have failed to listen on this port as well, but you may have some rules for this port in particular
  4. Try running curl with the "-i" option to display the response status+headers, to see if you get an HTTP 200 (I find it weird that curl is not complaining... it means that the HTTP POST went somewhere...)
  5. If none of the above helped, go to menu "Help" > "Report bug or enhancement", enter your email so that we know it's coming from you, and click "Send bug"
Let me know how it goes!

Xavier
philmoc
Posts: 6
Joined: Mon Jun 10, 2019 6:15 pm

Re: (Mac) LogMX HTTP Server Not Receiving Logs

Post by philmoc »

Getting an error trying to send bug report:
Error while getting upload response:

[IOException] - Server returned HTTP response code: 406 for URL:
https://logmx.com/app-reports/health-re ... 0g1pbo4h2a
4&code=5d55a60f51d6d911

Anyway, changing the port number and explicitly using the 127.0.0.1 IP did not seem to help. Here are my terminal results:

Code: Select all

MAC-PMoccio:public pmoccio$  lsof -nP -iTCP:8015
COMMAND  PID    USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
LogMX   6354 pmoccio   58u  IPv6 0x4f324df2b074e6af      0t0  TCP 127.0.0.1:8015 (LISTEN)
MAC-PMoccio:public pmoccio$ curl -i -H "Content-Type: application/json" http://127.0.0.1:8015/logmx -d '{"id":"1", "logger":"TestLogger", "level":"DEBUG", "message":"Test message"}' --trace-ascii /dev/stdout
== Info:   Trying 127.0.0.1...
== Info: TCP_NODELAY set
== Info: Connected to 127.0.0.1 (127.0.0.1) port 8015 (#0)
=> Send header, 136 bytes (0x88)
0000: POST /logmx HTTP/1.1
0016: Host: 127.0.0.1:8015
002c: User-Agent: curl/7.54.0
0045: Accept: */*
0052: Content-Type: application/json
0072: Content-Length: 76
0086: 
=> Send data, 76 bytes (0x4c)
0000: {"id":"1", "logger":"TestLogger", "level":"DEBUG", "message":"Te
0040: st message"}
== Info: upload completely sent off: 76 out of 76 bytes
<= Recv header, 17 bytes (0x11)
0000: HTTP/1.1 200 OK
HTTP/1.1 200 OK
<= Recv header, 2477 bytes (0x9ad)
0000: Access-control-allow-headers: Accept, Accept-CH, Accept-Charset,
0040:  Accept-Datetime, Accept-Encoding, Accept-Ext, Accept-Features, 
0080: Accept-Language, Accept-Params, Accept-Ranges, Access-Control-Al
00c0: low-Credentials, Access-Control-Allow-Headers, Access-Control-Al
0100: low-Methods, Access-Control-Allow-Origin, Access-Control-Expose-
0140: Headers, Access-Control-Max-Age, Access-Control-Request-Headers,
0180:  Access-Control-Request-Method, Age, Allow, Alternates, Authenti
01c0: cation-Info, Authorization, C-Ext, C-Man, C-Opt, C-PEP, C-PEP-In
0200: fo, CONNECT, Cache-Control, Compliance, Connection, Content-Base
0240: , Content-Disposition, Content-Encoding, Content-ID, Content-Lan
0280: guage, Content-Length, Content-Location, Content-MD5, Content-Ra
02c0: nge, Content-Script-Type, Content-Security-Policy, Content-Style
0300: -Type, Content-Transfer-Encoding, Content-Type, Content-Version,
0340:  Cookie, Cost, DAV, DELETE, DNT, DPR, Date, Default-Style, Delta
0380: -Base, Depth, Derived-From, Destination, Differential-ID, Digest
03c0: , ETag, Expect, Expires, Ext, From, GET, GetProfile, HEAD, HTTP-
0400: date, Host, IM, If, If-Match, If-Modified-Since, If-None-Match, 
0440: If-Range, If-Unmodified-Since, Keep-Alive, Label, Last-Event-ID,
0480:  Last-Modified, Link, Location, Lock-Token, MIME-Version, Man, M
04c0: ax-Forwards, Media-Range, Message-ID, Meter, Negotiate, Non-Comp
0500: liance, OPTION, OPTIONS, OWS, Opt, Optional, Ordering-Type, Orig
0540: in, Overwrite, P3P, PEP, PICS-Label, POST, PUT, Pep-Info, Perman
0580: ent, Position, Pragma, ProfileObject, Protocol, Protocol-Query, 
05c0: Protocol-Request, Proxy-Authenticate, Proxy-Authentication-Info,
0600:  Proxy-Authorization, Proxy-Features, Proxy-Instruction, Public,
0640:  RWS, Range, Referer, Refresh, Resolution-Hint, Resolver-Locatio
0680: n, Retry-After, Safe, Sec-Websocket-Extensions, Sec-Websocket-Ke
06c0: y, Sec-Websocket-Origin, Sec-Websocket-Protocol, Sec-Websocket-V
0700: ersion, Security-Scheme, Server, Set-Cookie, Set-Cookie2, SetPro
0740: file, SoapAction, Status, Status-URI, Strict-Transport-Security,
0780:  SubOK, Subst, Surrogate-Capability, Surrogate-Control, TCN, TE,
07c0:  TRACE, Timeout, Title, Trailer, Transfer-Encoding, UA-Color, UA
0800: -Media, UA-Pixels, UA-Resolution, UA-Windowpixels, URI, Upgrade,
0840:  User-Agent, Variant-Vary, Vary, Version, Via, Viewport-Width, W
0880: WW-Authenticate, Want-Digest, Warning, Width, X-Content-Duration
08c0: , X-Content-Security-Policy, X-Content-Type-Options, X-CustomHea
0900: der, X-DNSPrefetch-Control, X-Forwarded-For, X-Forwarded-Port, X
0940: -Forwarded-Proto, X-Frame-Options, X-Modified, X-OTHER, X-PING, 
0980: X-PINGOTHER, X-Powered-By, X-Requested-With
Access-control-allow-headers: Accept, Accept-CH, Accept-Charset, Accept-Datetime, Accept-Encoding, Accept-Ext, Accept-Features, Accept-Language, Accept-Params, Accept-Ranges, Access-Control-Allow-Credentials, Access-Control-Allow-Headers, Access-Control-Allow-Methods, Access-Control-Allow-Origin, Access-Control-Expose-Headers, Access-Control-Max-Age, Access-Control-Request-Headers, Access-Control-Request-Method, Age, Allow, Alternates, Authentication-Info, Authorization, C-Ext, C-Man, C-Opt, C-PEP, C-PEP-Info, CONNECT, Cache-Control, Compliance, Connection, Content-Base, Content-Disposition, Content-Encoding, Content-ID, Content-Language, Content-Length, Content-Location, Content-MD5, Content-Range, Content-Script-Type, Content-Security-Policy, Content-Style-Type, Content-Transfer-Encoding, Content-Type, Content-Version, Cookie, Cost, DAV, DELETE, DNT, DPR, Date, Default-Style, Delta-Base, Depth, Derived-From, Destination, Differential-ID, Digest, ETag, Expect, Expires, Ext, From, GET, GetProfile, HEAD, HTTP-date, Host, IM, If, If-Match, If-Modified-Since, If-None-Match, If-Range, If-Unmodified-Since, Keep-Alive, Label, Last-Event-ID, Last-Modified, Link, Location, Lock-Token, MIME-Version, Man, Max-Forwards, Media-Range, Message-ID, Meter, Negotiate, Non-Compliance, OPTION, OPTIONS, OWS, Opt, Optional, Ordering-Type, Origin, Overwrite, P3P, PEP, PICS-Label, POST, PUT, Pep-Info, Permanent, Position, Pragma, ProfileObject, Protocol, Protocol-Query, Protocol-Request, Proxy-Authenticate, Proxy-Authentication-Info, Proxy-Authorization, Proxy-Features, Proxy-Instruction, Public, RWS, Range, Referer, Refresh, Resolution-Hint, Resolver-Location, Retry-After, Safe, Sec-Websocket-Extensions, Sec-Websocket-Key, Sec-Websocket-Origin, Sec-Websocket-Protocol, Sec-Websocket-Version, Security-Scheme, Server, Set-Cookie, Set-Cookie2, SetProfile, SoapAction, Status, Status-URI, Strict-Transport-Security, SubOK, Subst, Surrogate-Capability, Surrogate-Control, TCN, TE, TRACE, Timeout, Title, Trailer, Transfer-Encoding, UA-Color, UA-Media, UA-Pixels, UA-Resolution, UA-Windowpixels, URI, Upgrade, User-Agent, Variant-Vary, Vary, Version, Via, Viewport-Width, WWW-Authenticate, Want-Digest, Warning, Width, X-Content-Duration, X-Content-Security-Policy, X-Content-Type-Options, X-CustomHeader, X-DNSPrefetch-Control, X-Forwarded-For, X-Forwarded-Port, X-Forwarded-Proto, X-Frame-Options, X-Modified, X-OTHER, X-PING, X-PINGOTHER, X-Powered-By, X-Requested-With
<= Recv header, 37 bytes (0x25)
0000: Date: Tue, 11 Jun 2019 17:00:30 GMT
Date: Tue, 11 Jun 2019 17:00:30 GMT
<= Recv header, 32 bytes (0x20)
0000: Content-type: application/json
Content-type: application/json
<= Recv header, 32 bytes (0x20)
0000: Access-control-allow-origin: *
Access-control-allow-origin: *
<= Recv header, 19 bytes (0x13)
0000: Content-length: 0
Content-length: 0

<= Recv header, 2 bytes (0x2)
0000: 
== Info: Connection #0 to host 127.0.0.1 left intact
MAC-PMoccio:public pmoccio$ 

Also attached a saved health report if that helps at all.
Attachments
healthReport.zip
(13.88 KiB) Downloaded 546 times
admin
Site Admin
Posts: 555
Joined: Sun Dec 17, 2006 10:30 pm

Re: (Mac) LogMX HTTP Server Not Receiving Logs

Post by admin »

Hello,

Looking at your Health Report, it seems that if you don't see any log entry, it's because the Log Parser you wrote (GlogJSONParser.GlogJSONParser) failed: it cannot find the class org.json.JSONArray (I guess it's the JSON library you'd like to use in order to parse the json log entry). If you want to use this class "org.json.JSONArray" in your parser, you'll need to put the JAR file containing this class in the LogMX "lib" folder. Or you can use the standard Java JSON features from the package "javax.json" (no need to use an external library to parse JSON).
If you want to check the errors that happen in your parser, you can check the LogMX log file in your home directory.

Also, concerning the "Report bug" feature, it seems that we have an issue with this file upload procedure on our web server, seems to be a configuration issue, working on it. Sorry about that.

Xavier
philmoc
Posts: 6
Joined: Mon Jun 10, 2019 6:15 pm

Re: (Mac) LogMX HTTP Server Not Receiving Logs

Post by philmoc »

Ah, so we do have a jar for that. I originally had it in LogMX's /jar folder. However, moving this file to the /lib folder still doesn't seem to do the trick. I, also changed startup.conf like so:

Code: Select all

# If your Parser or Manager needs additional JARs or classes, add their path here (absolute or 
# relative to LogMX directory):
#ADDITIONAL_CLASSPATH=jar/json-20141113.jar
ADDITIONAL_CLASSPATH=lib/json-20141113.jar
Looking at the log, I seem to get the same error.

I've attached the jar, parser and manager that we're using in a zip file. I was instructed to place the GlogJSONParser class folder in LogMX/parsers/classes and the GlogManager class folder in LogMX/managers/classes. The json-20141113.jar is the jar mentioned above. These ARE working for other people on my team on Windows, so I'm unsure why they wouldn't be working for me unless there is some weird gotcha on Mac or an extra hoop to jump through that I'm missing.
Attachments
logmx.zip
(82.62 KiB) Downloaded 555 times
philmoc
Posts: 6
Joined: Mon Jun 10, 2019 6:15 pm

Re: (Mac) LogMX HTTP Server Not Receiving Logs

Post by philmoc »

Actually, after clearing the log and refreshing, I don't see the error in the logs anymore, but I'm still not seeing any logs in LogMX.

Not seeing any clear errors in the log file. Attached another health report just in case.
Attachments
health3.zip
(9.92 KiB) Downloaded 531 times
admin
Site Admin
Posts: 555
Joined: Sun Dec 17, 2006 10:30 pm

Re: (Mac) LogMX HTTP Server Not Receiving Logs

Post by admin »

I tried to open the same URL (http-server://127.0.0.1:8080/logmx), with your Parser "GlogJSONParser.GlogJSONParser", with your library "json-20141113.jar", and with your LogMX config file ("logmx.properties" from your health-report), and it worked fine, even with all the HTTP headers you specified in "managers.properties", from both Postman and curl:
logmx.png
logmx.png (34.2 KiB) Viewed 40505 times
curl.png
curl.png (53.18 KiB) Viewed 40505 times
postman.png
postman.png (90.64 KiB) Viewed 40505 times
Honestly I don't understand why it doesn't work on your side. I would recommend trying with a fresh install of LogMX on an other computer (just your Parser, your json JAR, and then try posting a log entry). You can also try on the same machine but with a different Parser.

Also, I'm wondering what is displayed in your AutoRefresh toolbar (below the log entries tables) when you post multiple log entries through HTTP: do you still see "Detecting format... 0/100" after a dozen of log entries sent? Or you see at least 1/100? (which would mean that at least 1 log entry was found)

Let me know how it goes.
philmoc
Posts: 6
Joined: Mon Jun 10, 2019 6:15 pm

Re: (Mac) LogMX HTTP Server Not Receiving Logs

Post by philmoc »

Okay, it seems that in my efforts to get this to work early on I had tried making alterations to the json object's formatting in order to see if that helped. While doing so I had omitted the square brackets and I kept using this json object in all the requests I have been testing with since, which seems to avoid the class not found error as the body no longer includes a JSON Array. If I put the square brackets back in and try to send that request, the error starts appearing again. To clarify:

Code: Select all

curl -i -H "Content-Type: application/json"  -d '{"id":"1", "logger":"TestLogger", "level":"DEBUG", "message":"Test message"}'  http://127.0.0.1:8080/logmx
Will increment "Detecting format... X/100", but LogMX will not display the log. I think this is just a quirk of our internal parser as it expects a JSON Array.

Code: Select all

curl -i -H "Content-Type: application/json" -X POST -d "[{\"id\":\"1\", \"logger\":\"TestLogger\", \"level\":\"DEBUG\", \"message\":\"Test message\"}]" http://127.0.0.1:8080/logmx
Will NOT increment "Detecting format... X/100" and results in class not found error in LogMX's log file.


So the issue still seems to be that LogMX cannot find my jar file no matter what I try to do. I even tried changing the relative path to an absolute path like so:

Code: Select all

# If your Parser or Manager needs additional JARs or classes, add their path here (absolute or 
# relative to LogMX directory):
ADDITIONAL_CLASSPATH=/Applications/LogMX_v7.8.0_pro/lib/json-20141113.jar
I was able to get this working on another machine which is a PC, but I assume when you got this working on your end you were on a Mac? Can I ask for where you put your jar and exactly how you set your startup.conf?
admin
Site Admin
Posts: 555
Joined: Sun Dec 17, 2006 10:30 pm

Re: (Mac) LogMX HTTP Server Not Receiving Logs

Post by admin »

I did test on macOS, but only to reply at your first post to check how the HTTP server is behaving on macOS Mojave (I didn't use your Parser because I didn't have it back then, so I used a Parser I already had). But I just tried with your Parser and your JAR, and I reproduced the issue.

I still think it would be easier for you to use the Java features to parse this JSON (so that you don't need this JAR), but anyways, there's something wrong with how the macOS JVM is loading the classes when started from the native app ("LogMX.app"): normally LogMX is able to use any JAR file dropped in the LogMX "/lib" directory. So for example, you can make it work if you start LogMX using the shell script "logmx.command" (from LogMX root dir) from a Terminal, or by double-clicking on this script in the Finder.

I think I now what's going on with this "lib/" folder, and also why the variable ADDITIONAL_CLASSPATH from "startup.conf" has no effect on Mac. We need more time to investigate and probably fix it, but in the mean time, you should be fine with "logmx.command", or by using the Java classes instead of this JAR (let me know if you need help for that). Sorry for the inconvenience.

I will post a message in this thread to let you know about the potential fix of ADDITIONAL_CLASSPATH on macOS.

Xavier
philmoc
Posts: 6
Joined: Mon Jun 10, 2019 6:15 pm

Re: (Mac) LogMX HTTP Server Not Receiving Logs

Post by philmoc »

Thanks. For now, your suggested work around seems to work.
admin
Site Admin
Posts: 555
Joined: Sun Dec 17, 2006 10:30 pm

Re: (Mac) LogMX HTTP Server Not Receiving Logs

Post by admin »

Hello,

LogMX v7.9.0 has just been released, and it contains, among many other things, a fix for ADDITIONAL_CLASSPATH (i.e. this variable in "startup.conf" now also works on macOS to add extra classpath elements).

Xavier
Post Reply