Skip to content

Instantly share code, notes, and snippets.

@GitSumito
Created December 11, 2017 03:23
Show Gist options
  • Save GitSumito/0548ea59aa6325834aedf23e84ba53fd to your computer and use it in GitHub Desktop.
Save GitSumito/0548ea59aa6325834aedf23e84ba53fd to your computer and use it in GitHub Desktop.
LTSVフォーマットから該当の項目のみを抽出 ref: https://qiita.com/S-T/items/2e41accb5279155830ee
time_local:11/Dec/2017:12:09:25 +0900 request:"GET /admin/widget/ HTTP/1.1" http_x_forwarded_for:"-" uid_got:"-" req_body_start:""
time_local:11/Dec/2017:12:09:25 +0900 request:"GET /admin/widget/ HTTP/1.0" http_x_forwarded_for:"192.168.120.120" uid_got:"app_uid=060012AC5A99275A050070A502030303" req_body_start:""
time_local:11/Dec/2017:12:09:26 +0900 request:"GET /admin/event/ HTTP/1.1" http_x_forwarded_for:"-" uid_got:"-" req_body_start:""
time_local:11/Dec/2017:12:09:26 +0900 request:"GET /admin/event/ HTTP/1.0" http_x_forwarded_for:"192.168.120.120" uid_got:"app_uid=060012AC5A99275A050070A502030303" req_body_start:""
# tail access.log | lltsv -k time_local,http_x_forwarded_for
time_local:11/Dec/2017:12:09:22 +0900 http_x_forwarded_for:"-"
time_local:11/Dec/2017:12:09:22 +0900 http_x_forwarded_for:"192.168.120.120"
time_local:11/Dec/2017:12:09:22 +0900 http_x_forwarded_for:"-"
time_local:11/Dec/2017:12:09:22 +0900 http_x_forwarded_for:"192.168.120.120"
time_local:11/Dec/2017:12:09:24 +0900 http_x_forwarded_for:"-"
time_local:11/Dec/2017:12:09:24 +0900 http_x_forwarded_for:"192.168.120.120"
time_local:11/Dec/2017:12:09:25 +0900 http_x_forwarded_for:"-"
time_local:11/Dec/2017:12:09:25 +0900 http_x_forwarded_for:"192.168.120.120"
time_local:11/Dec/2017:12:09:26 +0900 http_x_forwarded_for:"-"
time_local:11/Dec/2017:12:09:26 +0900 http_x_forwarded_for:"192.168.120.120"
#
yum install wget -y
wget https://github.com/sonots/lltsv/releases/download/v0.3.0/lltsv_linux_amd64 -O lltsv
chmod a+x lltsv
mv lltsv /usr/sbin/.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment