Search code examples
restamazon-web-serviceskaa

REST LogAppender giving 500 and then 400 error while posting data on aws beanstalk


I have configured 3 log appenders in my zeppelin demo app. Two of them are cassandra log appenders and other one is REST log appender. Cassandra log appenders are working fine and I am able to see the data in cassandra DB and zeppelin on AWS EC2 host but the REST log appender is not able to send the data.

I have kept the host as localhost and have tried the default and a new port as well but nothing seems to work. Both the default and new ports are open in the AWS security settings. So no issue with the host or port definition.

Logs are shown below.

2017-02-06 23:53:57,240 [pool-33-thread-1] TRACE o.k.k.s.a.r.appender.RestLogAppender - [24510582477967418632] executing POST http://enmonitor.ap-south-1.elasticbeanstalk.com:80/powerdata HTTP/1.1


2017-02-06 23:53:57,240 [nioEventLoopGroup-9-1] TRACE o.k.k.s.t.t.t.netty.KaaTcpEncoder - Returned future [DefaultChannelPromise@2a198e0d(failure: java.nio.channels.ClosedChannelException)] isSuccess [false] isDone [true] isCancelled [false] cause [java.nio.channels.ClosedChannelException] for frame MqttFrame [messageType=KAASYNC, currentState=NONE] 

2017-02-06 23:53:57,246 [nioEventLoopGroup-9-1] TRACE o.k.k.s.t.t.t.netty.KaaTcpEncoder - Write operation failed due to: java.nio.channels.ClosedChannelException: null 


2017-02-06 23:53:57,319 [pool-33-thread-1] TRACE o.k.k.s.a.r.appender.RestLogAppender - [24510582477967418632] received HTTP/1.1 500 Internal Server Error [Content-Type: text/html; charset=UTF-8, Date: Mon, 06 Feb 2017 18:23:57 GMT, Server: Apache/2.4.25 (Amazon) mod_wsgi/3.5 Python/3.4.3, transfer-encoding: chunked, Connection: keep-alive] response code 

2017-02-06 23:53:57,321 [pool-33-thread-1] WARN  o.k.k.s.a.r.appender.RestLogAppender - [RestLogAppender] bad response code 500 


2017-02-06 23:53:57,328 [nioEventLoopGroup-9-1] TRACE o.k.k.s.t.t.t.netty.KaaTcpEncoder - Write operation failed due to: java.nio.channels.ClosedChannelException: null

Solution

  • The 500 error that I was facing was due to following:

    I found two errors with my configuration of RestLogAppender in the admin panel. First, I had put http:// before my host. Had to remove the same. Second, I should have mentioned Relative URI path starting and ending with a forward slash /.

    After resolving 500 error, I was still getting 400 error. It was due to the following reasons:

    I had given slightly different names to the JSON fields in the Django models. The sequence of the fields did not matter but the name of fields did matter.