命令行环境解码url是运维的必备技能,尤其是在排查应用日志的时候。而最佳实践还是不依赖任何编程能直接敲个命令就搞定。。。
以下内容基于CentOS6.9系统环境。
命令行软件包
1 2 3
| [root@test-204 ~]# rpm -qf /usr/bin/urlencode gridsite-clients-2.2.6-2.el6.x86_64 [root@test-204 ~]#
|
安装环境
1 2 3
| yum -y install http://dl.fedoraproject.org/pub/epel/6/x86_64/Packages/g/gridsite-clients-2.2.6-2.el6.x86_64.rpm \ http://dl.fedoraproject.org/pub/epel/6/x86_64/Packages/g/gridsite-libs-2.2.6-2.el6.x86_64.rpm \ http://dl.fedoraproject.org/pub/epel/6/x86_64/Packages/c/canl-c-2.1.8-1.el6.x86_64.rpm
|
使用查看
1 2 3 4 5
| # 查看归档日志 urlencode -d decode $(zcat access.log.2018_09_01_22.log.gz |awk '{print $7}' |sort |uniq -c |sort -rn |head )
#查看实时日志 tailf access.log |awk '{print $7}'|xargs urlencode -d decode
|
参考文档