Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting the private ip address of an Rook/Shiny page user

I have created some web app using Rook which listen to my network ip (192.168.xx.xx) at port 8000. Everyone inside my office can connect to them just typing http://192.168.xx.xx:8000/page_name in the browser. I need to monitor these pages usage and wonder how I can get the network ip address of those connected to them.

I'm not experienced in web development and from the research done so far it seems that using client side code like JavaScript it's very difficult (almost impossible) to achieve that, (correct me if I'm wrong). So, my question is: is there any way of getting the network client ip using server side code inside an Rook application? (If needed I'd be willing to change the web server, any solution appreciated).

Thanks and sorry in advance should my question seem confusing... in particular I'm unsure if other tags are needed.

EDIT: I would also accept answers using something different than Rook (but still in R)

EDIT 2: I have set Shiny Server following this link. I'm at step of configuring the Server in order to get the access_log that, according to @Thell, contains the information I need. In The shiny-server.conf I have added the relative statement and now is:

run_as shiny;

server {
  listen 3838;

  location / {
    site_dir /var/shiny-server/www;
    log_dir /var/shiny-server/log;
    directory_index on;
  }

}

access_log /home/michelec/log.txt;

the last line should tell shiny to write the access_log into my home folder. Nothing happens however, the log remains blank. according to here, in the Formats section, I should receive one of these logs:

default ':remote-addr - - [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"'
short ':remote-addr - :method :url HTTP/:http-version :status :res[content-length] - :response-time ms'
tiny ':method :url :status :res[content-length] - :response-time ms'
dev concise output colored by response status for development use

depending if you leave the default format or you change it.

like image 829
Michele Avatar asked Jun 14 '13 22:06

Michele


1 Answers

It seems that Rook will only provide remote add when backed by rApache.

Another option would be to setup shiny-server from the fine folks @ RStudio and then configure the access log such that you'd be able to parse that using the selected access log format that you choose.

I'd lean toward the Shiny solution as the author of rApache also helped on Shiny and Shiny (being that it is an official product of RStudio) seems poised for growth and long term availability which we can't really say about rApache (as fine as it is!).

like image 100
Thell Avatar answered Nov 02 '22 12:11

Thell