y0k4i-1337 / rotating-proxy

Rotating proxy with Docker
MIT License
0 stars 0 forks source link

How to view logs? #3

Open 123bistami opened 2 years ago

123bistami commented 2 years ago

Hello,

thank you for sharing your work👍 how can i view the log output (the docker logs container_id is mixed, i will see the response code by ip), is there a way to view log of response codes 200,403,503… If i insert following to haproxy.cfg defaults /etc/haproxy/errors/400.http errorfile 403 /home/ubuntu/rotating-proxy/errors/403.http would it work?

Can i Integrate it with logz.io or better is there a way to monitor the response codes in the built in stats function?

pls help, thanks.

y0k4i-1337 commented 2 years ago

I've never have tweaked with this option but you should be able to customize your configuration file the way that fit you better. The only restriction is to keep the name and the ruby code inside it, since this is used to create the final configuration file with all the proxies in it.

123bistami commented 2 years ago

I will have mutiple backends, for multiple proxy lists e.g. proxyA_list.txt, proxyB_list.txt And on haproxy proxyA backend proxyB backend this should be easy todo, can you modify starts.rb and send me the snippet, i am not a ruby expert, thanks

y0k4i-1337 commented 2 years ago

I think this is the snippet you are looking for. This is responsible for setting the front end port. Since we don't have an option to provide the desired port, the easiest way by now should be copying the folder, changing this value in the code and then running docker from there.

 ​  ​class​ ​Haproxy​ < ​Base 
 ​    ​attr_reader​ ​:backends 

 ​    ​def​ ​initialize​(​port​ ​=​ ​5566​) 
 ​      ​@config_erb_path​ ​=​ ​"/usr/local/etc/haproxy.cfg.erb" 
 ​      ​@config_path​ ​=​ ​"/usr/local/etc/haproxy.cfg" 
 ​      ​@backends​ ​=​ ​[​] 
 ​      ​super​(​port​) 
 ​    ​end