I want to get referrals and IP information from nginx access log in php

Asked 2 years ago, Updated 2 years ago, 98 views

  • Ubuntu
  • nginx
  • php5-fpm

Access Logs
/var/log/nginx/hoge.com.access.log

I would like to regularly obtain referrals and IPs from other sites on hoge.com using crontab.
I imagine that I will use crontab, but if there is any other way to run it regularly, please let me know.

I would like to create a monitoring page called monitor.hoge.com where I can organize and display access log information in php.

file_get_contents to retrieve.

The log file you want to retrieve is
/var/log/nginx/hoge.com.access.log
That's it.

To summarize,
Create a php file and use file_get_contents to extract IP and references from /var/log/nginx/hoge.com.access.log and INSERT them into the database.
After that, the information is displayed in php on the management screen.

That's it.

I look forward to hearing from you.

php cakephp nginx

2022-09-30 20:56

1 Answers

If you use fluidd to store the output of the access log as a trigger, the php on the management screen will only need to read DB and display information.

If you google "Nginx fluentd DB name", you will find out more.


2022-09-30 20:56

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.