1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

アクセスログからユーザーエージェントを抜き出す

Last updated at Posted at 2019-07-29

以下、実際の活用例

cat /var/log/httpd/access_log* | cut -f6 -d'"' | sort -r | uniq

cat /var/log/httpd/ip\_direct\_custom_log* | cut -f6 -d'"' | sort -r | uniq

cat /var/log/httpd/ssl\_access\_log* | cut -f6 -d'"' | sort -r | uniq

cut ―行から固定長またはフィールド単位で切り出す
-f N番目のフィールドを抜き出す
-d 区切り文字を変更、デフォルトはタブ

sort 並べ替え
-r reverseの略、逆順で並べ替え
1フィールド目の値でソートがデフォルト

uniq 重複削除

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?