Change logging format in Kong - amazon-elb

I'm new to Kong concept and need to change the logging format of Kong. For example, I need to customize the IP from the remote instances. I already tried to use X-Forwarded-For but I am still seeing load balancer IP. With that, I'd like to know how can it be achieved. Thank you so much in advance!

I think you should review the rendering of the template in the nginx_kong.lua file
When the kong gateway starts, the nginx.conf file is generated by template rendering, and there are two files in the /usr/local/kong directory.
Every time kong start, it will be based on /etc/kong. /kong.conf file and template generation.
Source on this post:
http://www.programmersought.com/article/8094116333/

Related

Different nginx config for different environments

I have a Rails app hosted in two different servers (both with dokku) for production and staging environments. The first one is hosted in www.mywebsite.com.br and the second one in www.staging.mywebsite.com.br.
We use a SSL certificate in production so I wrote
return 301 https://www.mywebsite.com.br$request_uri;
in my nginx.conf.sigil file so that every path redirects to the https URI. All working fine.
But now when I go to the staging environment, all URIs also redirect me to the https://www.mywebsite.com.br instead of http://www.staging.mywebsite.com.br. It makes sense, since I'm redirecting all requests in that line, but I can't seem to find a solution to configure my nginx.conf.sigil file for those two different needs.
Thanks a lot in advance and happy new year =)
You'll need a slightly separate nginx conf file for each server/environment, substituting in the correct domain name for each. You can see https://serverfault.com/questions/250476/how-to-force-or-redirect-to-ssl-in-nginx for more details and examples.

dropwizard get on demand jdbi connection

I have a simple CRUD application with backend code in dropwizard. The entire app just comprises of simple resource classes and crud operations except one case where some business logic is involved.
I am trying to extract this into a service instead of putting it in the resource class itself. But for that my service would need an ondemand jdbi connection to access data and do its thing.
All my connect strings and config values are in YML file. Since this app would be running on different servers with different yml files, I dont want to hardcode the yml file name in order to read it again, to get the connect strings and do it that way.
How do I achieve this?
Can you detect what environment you are on?
If so, can you do something like ${environment}.yml?
There is Configuration project on apache which might help.
Otherwise, is it a case of in dev you want to run
java -jar app.jar server dev.yml
and in prod you want to run java -jar app.jar server prod.yml? I imagine you have separate daemons in each environment. So, those environment's will pick up the right configuration, if you've configured them that way.
Otherwise, if the property names are the same, but their values differ, and you pick up the right yml in the right environment, things should work.
If I haven't addressed your question, can you please elaborate your problem a little more?

Due to Haproxy I didn't get the client ip address in ruby on rails

I am using Haproxy for load balancing.
My website run on ruby on rails.
I have done some googling and come to know to add this line
option forwardfor header X-Client
in /etc/haproxy.cfg file.
In my rails application I'm using
request.env["HTTP_X_FORWARDED_FOR"]
but this give me my master application ip
How do I get client ip address.
On top of the option forwardfor directive, you should also use option http-server-close. If you don't, HAProxy will only add the header to the initial request.
If you did that and restarted HAProxy, it should work.
Also I find it strange that your code relies on a variable name "HTTP_X_FORWARDED_FOR" and that the header name would be X-Client. Please just use "option forwardfor" which will set the X-Forwarded-For header that I think your application is looking for.

Http settings for Processmakers

I know there is a way to set your processmaker in such you can access it by using the following format:
processmaker.example.com
But is there a way to configure it in such you can access it by using:
example.com/processmaker/
Thank you and good day.
ProcessMaker is configured to respect the structure: xxx/sysworkflow/en/classic/login/login, so changing it to:
http://XXX.XXX.XXX.XXX/processmaker/
it won't work unlike wordpress that you have the possibility to create subfolders.
In the case of ProcessMaker domains or ports are created to have access. In your case you can create a rule to redirect your URL to processmaker login, it means when you enter to
XXX.XXX.XXX.XXX/processmaker/
it redirects to:
xxx/sysworkflow/en/classic/login/login
You need to modify your .htaccess file or pmos.conf file depending on how you installed ProcessMaker.
This information may help you to redirect your URL.
Regards.
processmaker
Unfortunately, ProcessMaker needs to be on the root of any server configuration. This is due to the .htaccess configuration file, which goes to sysGeneric.php.
Another problem is that the application uses full paths (e.g. /js/maborak.js) and it won't work on a folder unless you modify the templates.

No data in rails 3 access.log

One of the log files that i used regularly on my last server was the rails access.log
On our new host the file isn't supplying any data. I did a search and couldn't find any reference to the file. I'm wondering if needs to be configured and/or whether there are specific ownership/permission settings on the file that need to be in place.
Thanks for your help.
Access.log is usually written by the web server, not Rails. Check the apache or nginx or whatever config to find out where it's writing it. My guess is you're used to it being configured to be written in the same place as your rails logs, but now it isn't.

Resources