log_hits
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| log_hits [2016/05/20 06:59] – luke7858 | log_hits [2024/05/23 07:26] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| === Summarising custom logs === | === Summarising custom logs === | ||
| + | The following uses lsof to check all open log files by the web server, (access and error logs). | ||
| + | \\ | ||
| + | You will need to run this command first to save the logs files as LOGS: | ||
| <sxh bash> | <sxh bash> | ||
| LOGS=$(lsof -ln | awk '$4 ~ /[0-9]w/ && $5 ~ /REG/ {FILE[$NF]++}END{for (i in FILE) print i}') | LOGS=$(lsof -ln | awk '$4 ~ /[0-9]w/ && $5 ~ /REG/ {FILE[$NF]++}END{for (i in FILE) print i}') | ||
| </ | </ | ||
| \\ | \\ | ||
| + | === Browser and robot.txt check === | ||
| + | Now you can run the following command to receive an output: | ||
| <sxh bash> | <sxh bash> | ||
| for log in $(echo " | for log in $(echo " | ||
| </ | </ | ||
| - | |||
| - | \\ | ||
| \\ | \\ | ||
| Example Output: | Example Output: | ||
| Line 47: | Line 50: | ||
| 7 113.190.128.197 "POST /xmlrpc.php | 7 113.190.128.197 "POST /xmlrpc.php | ||
| 7 117.4.251.108 "POST /xmlrpc.php | 7 117.4.251.108 "POST /xmlrpc.php | ||
| + | </ | ||
| + | \\ | ||
| + | === Finding Crawlers === | ||
| + | **Note:** You will need to change date range and make sure you run the very first LOG command on this page first. | ||
| + | <sxh bash> | ||
| + | LC_ALL=C awk '/ | ||
| + | </ | ||
| + | \\ | ||
| + | === Accurate number of Apache requests per hour === | ||
| + | **Note:** Change date range and log file locationg | ||
| + | <sxh bash> | ||
| + | LC_ALL=C awk '/ | ||
| + | </ | ||
| + | \\ | ||
| + | === Log requests for Specific date/time range === | ||
| + | **Note:** Change date/time and log file location | ||
| + | <sxh bash> | ||
| + | LC_ALL=C awk -F \" '/ | ||
| </ | </ | ||
log_hits.1463727569.txt.gz · Last modified: 2024/05/23 07:26 (external edit)
