•   0 Followers
  •   Numbers of essay: 74
  • Today Visitors: 23
  • Total Visitors: 44967
  • About Me
  • Log 分析 指令

      
      129
      0
      0
       Learning , Linux
    把log裡 ( )內的IP列出後 計算出現次數
    Log範例: module-list request from 51.13.199.104.bc.googleusercontent.com (1.2.3.4)

    $:cat XXXX.log | grep ^\(*\.*\.*\.*\)$| grep -oE "\(([0-9]{1,3}\.){3}[0-9]{1,3}\)" | cut -d "(" -f 2 | cut -d ")" -f 1|sort|uniq -c |sort -nr

    表達所有IP之正規表達式
    ^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$

    Message Board