从只有 POST 类型请求的日志中提取所有唯一 URL
Extract all unique URL from log with only POST type of the request
我有一个包含此类记录的日志文件:
41.201.181.27 - [2019-04-06 18:22:02] "GET /images/stands/photo_mois.jpg HTTP/1.1" 304 - "http://example.com/popup.php?choix=mois" "Mozilla/4.0" "-"
我有获取所有具有唯一 URL 的记录的脚本:
cut -f4 -d\" < logfile | sort -u
我需要如何更改它以获取仅具有 POST 类型请求的唯一 URL?
您始终可以通过管道传输到 cut
命令。如下所示
grep POST /path/to/myfile.log | cut -f4 -d\" | sort -u
我有一个包含此类记录的日志文件:
41.201.181.27 - [2019-04-06 18:22:02] "GET /images/stands/photo_mois.jpg HTTP/1.1" 304 - "http://example.com/popup.php?choix=mois" "Mozilla/4.0" "-"
我有获取所有具有唯一 URL 的记录的脚本:
cut -f4 -d\" < logfile | sort -u
我需要如何更改它以获取仅具有 POST 类型请求的唯一 URL?
您始终可以通过管道传输到 cut
命令。如下所示
grep POST /path/to/myfile.log | cut -f4 -d\" | sort -u