access.log
使用配置方式:
# 日志格式
log_format main '$time_local|10.4.24.116|$request|$status|'
'$remote_user|$remote_addr|$http_user_agent|$http_referer|$host|'
'$bytes_sent|$request_time|$upstream_response_time|$upstream_addr|'
'$connection|$connection_requests|$upstream_http_content_type|$upstream_http_content_disposition|$uuid';
access_log logs/access.log main; #设置访问日志打印路径
日志实例:
01/Aug/2017:12:01:32 +0800|10.4.24.116|GET /images/logo/new-logo2.ico HTTP/1.1|200|
-|111.202.5.249|Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36|http://crm111.chime.me/admin/home|crmtest.chime.me|
15707|0.000|-|-|
4909722|3|-|-|f3a50c3e-be90-4693-9d7c-c414d825fd22
日志参数:
参数 | 说明 | 实例 |
---|---|---|
$time_local | 访问的时间和时区 | 01/Aug/2017:12:01:32 +0800 |
$request | 请求的URL和HTTP信息 | GET /images/logo/new-logo2.ico HTTP/1.1 |
$status | 请求的状态 | 200 |
$remote_user | 客户端用户名称 | - |
$remote_addr | 客户端地址 | 111.202.5.249 |
$http_user_agent | 用户终端浏览器等信息 | Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36 |
$http_referer | url跳转来源 | http://crm111.chime.me/admin/home |
$host | 域名 | crmtest.chime.me |
$bytes_send | 发送给客户端的字节数 | 15707 |
$request_time | 请求处理时间 | 0.000 |
$upstream_response_time | 服务主机的响应时间 | - |
$upstream_addr | 服务主机的地址 | - |
$connection | 当前的连接序号 | 4909722 |
$connection_requests | 当前的连接数量 | 3 |
$upstream_http_content_type | 响应的内容格式,如:text/html;charset=UTF-8 | - |
$upstream_http_content_disposition | 不明 | - |
$uuid | perl_set $uuid 'sub {$ug = new Data::UUID;$str = $ug->create_str();return $str;}'; | 用来唯一标示一个请求连接 |
error.log
2017/08/01 18:29:43 [info] 233168#0: *4925140 client 10.2.203.101 closed keepalive connection
2017/08/01 18:29:43 [info] 233168#0: *4925138 client 10.2.203.101 closed keepalive connection
2017/08/01 18:29:43 [info] 233168#0: *4925133 client 10.2.203.101 closed keepalive connection
类型 | 作用 | 实例 |
---|---|---|
时间 | 2017/08/01 18:29:43 | |
日志等级 | [info] | |
错误信息 | 233168#0: *4925133 client 10.2.203.101 closed keepalive connection |
log4j
access.log
log4j的access日志:
2017-08-01-16:24:35 |1501575875145|111.202.5.248|10000000514|Xiaoxuexuexuexue Wang|
crm111.chime.me|/admin/lead/timeline/all|
https://crm111.chime.me/admin/lead/detail?leadId=671013327073323&pos=0&normal=false&type=all&stageId=&filter=%7B%7D&filterId=&curPage=0&pageSize=50&sortType=&desc=&groupId=0|
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36|web|
{"pageNo":"0","pageSize":"20","agentActionLabel":"-1","leadId":"671013327073323","_":"1501575891980"}|
d4b671b5-85c0-4fa3-90a4-d8e243a04aed
参数 | 说明 | 实例 |
---|---|---|
timestamp | 时间戳 | 2017-08-01-16:24:35 |
userId | 用户ID | 1501575875145 |
remoteIp | 用户的ip | 111.202.5.248 |
username | 用户的name | Xiaoxuexuexuexue Wang |
domain | 域名 | crm111.chime.me |
uri | uri | /admin/lead/timeline/all |
refer | 哪个页面链接过来的 | https://crm111.chime.me/admin/lead/detail?leadId=671013327073323&pos=0&normal=false&type=all&stageId=&filter=%7B%7D&filterId=&curPage=0&pageSize=50&sortType=&desc=&groupId=0 |
userAgent | 用户终端浏览器信息 | Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36 |
termailType | 3g:mobile web:other | web |
param json | 请求参数信息 | {"pageNo":"0","pageSize":"20","agentActionLabel":"-1","leadId":"671013327073323","_":"1501575891980"} |
requestId | 用于定位access log与业务log | d4b671b5-85c0-4fa3-90a4-d8e243a04aed |
homethy_out.log
配置
2017-08-01 16:36:25|1501576585413|INFO|501581213053651|bb310ae5-4fd0-475f-9686-0556989a5f36|(CrmWebBusiness.setUserIdFromRequest:199)|[setUserIdFromRequest] ticketRedisKey: b372bdcdddb0cff84174a0bdcc63f39c_crm111.chime.me, userId: 501581213053651
2017-08-01 16:36:25|1501576585413|INFO|501581213053651|bb310ae5-4fd0-475f-9686-0556989a5f36|(TicketManagerServiceImpl.checkTicket:55)|[checkTicket] business: CRMWEB, BusinessBase [userId=501581213053651, maxAge=2592000, path=/, domain=chime.me, allowMultiLogin=true, keepLogin=true]
2017-08-01 16:36:25|1501576585414|INFO|501581213053651|bb310ae5-4fd0-475f-9686-0556989a5f36|(CrmWebBusiness.checkTicket:103)|[checkTicket] check ticket success, userId: 501581213053651, serverName: crm111.chime.me
2017-08-01 16:36:25|1501576585415|INFO|501581213053651|bb310ae5-4fd0-475f-9686-0556989a5f36|(CrmWebBusiness.setUserIdFromRequest:199)|[setUserIdFromRequest] ticketRedisKey: b372bdcdddb0cff84174a0bdcc63f39c_crm111.chime.me, userId: 501581213053651
2017-08-01 16:36:25|1501576585415|INFO|501581213053651|bb310ae5-4fd0-475f-9686-0556989a5f36|(TicketManagerServiceImpl.getUser:107)|[getUser] business: CRMWEB, BusinessBase [userId=501581213053651, maxAge=2592000, path=/, domain=chime.me, allowMultiLogin=true, keepLogin=true]
2017-08-01 16:36:25|1501576585416|INFO|501581213053651|bb310ae5-4fd0-475f-9686-0556989a5f36|(Slf4jLog.info:67)| user info: user: User{id=501581213053651, autoId=10000014481, account='info@chime.me', password='30:5b42403262613266303863:169cdc779cdbc38462cea51238956973f29e4854eb71327f189a84f9cf849b53', firstName='Info', lastName='Chime', phoneNumber='8719821277', phonePrivate=true, role=0, headUrl='http://image.chime.me/image/fs01/user-info/20170601/19/original_61547355077197976.jpeg', chatHeadUrl='http://image.chime.me/image/fs01/user-info/20170601/19/original_61547355077197976.jpeg', gender=0, source='Portal', inviterId='', headTx='', status=0, teamId=501581213053651, userState=32, isSystemHead=true, hasBuiltSite=false, createTime=Tue Aug 16 16:20:37 CST 2016, updateTime=null, fullName='Info Chime', roleName='agent', teamRole=0, teamRoleName='Admin', nimAccid='b0vufgib37ivn9q3yiw1_test'}
2017-08-01 16:36:25|1501576585416|INFO|501581213053651|bb310ae5-4fd0-475f-9686-0556989a5f36|(Slf4jLog.info:67)|loginInterceptor: user info: User{id=501581213053651, autoId=10000014481, account='info@chime.me', password='30:5b42403262613266303863:169cdc779cdbc38462cea51238956973f29e4854eb71327f189a84f9cf849b53', firstName='Info', lastName='Chime', phoneNumber='8719821277', phonePrivate=true, role=0, headUrl='http://image.chime.me/image/fs01/user-info/20170601/19/original_61547355077197976.jpeg', chatHeadUrl='http://image.chime.me/image/fs01/user-info/20170601/19/original_61547355077197976.jpeg', gender=0, source='Portal', inviterId='', headTx='', status=0, teamId=501581213053651, userState=32, isSystemHead=true, hasBuiltSite=false, createTime=Tue Aug 16 16:20:37 CST 2016, updateTime=null, fullName='Info Chime', roleName='agent', teamRole=0, teamRoleName='Admin', nimAccid='b0vufgib37ivn9q3yiw1_test'}, checkPass: true
2017-08-01 16:36:25|1501576585447|INFO|501581213053651|bb310ae5-4fd0-475f-9686-0556989a5f36|(LeadController.leadDetail:1361)|leadDetail-------------start----
2017-08-01 16:36:25|1501576585926|INFO|501581213053651|bb310ae5-4fd0-475f-9686-0556989a5f36|(LeadController.leadDetail:1524)|userTeam teamType=======1
2017-08-01 16:36:25|1501576585926|INFO|501581213053651|bb310ae5-4fd0-475f-9686-0556989a5f36|(LeadController.leadDetail:1535)|000000000000000000000
类型 | 作用 | 实例 | |
---|---|---|---|
df.format(Long.valueOf(loggingEvent.getTimeStamp())) | 格式化时间戳 | 2017-08-01 16:36:25 | |
loggingEvent.getTimeStamp() | 时间戳 | 1501576585926 | |
loggingEvent.getLevel() | 日志等级 | INFO | |
this.getUserId(loggingEvent) | 用户id | 501581213053651 | |
this.getUniqIndex(loggingEvent) | 日志时间独特的索引 | bb310ae5-4fd0-475f-9686-0556989a5f36 | |
this.locationInfo(loggingEvent.getLocationInformation()) | 日志位置信息 | LeadController.leadDetail:1535) | |
this.throwableName(loggingEvent) | 日志详细信息 | userTeam teamType=======1 | 、 |
this.throwableStackTrace(loggingEvent) | 异常信息 | exceptin异常 |
logs/perf/perfStats.log
perfStatus.log
的信息是perf4j结合log4j来打印的,下面打印的格式是默认的。
Performance Statistics 2017-08-03 15:59:10 - 2017-08-03 15:59:20
Tag Avg(ms) Min Max Std Dev Count
/admin/appointment/upcoming 8.0 8 8 0.0 1
/admin/dripmail/application/list/v2 8.0 8 8 0.0 1
/admin/group/list/simple 7.0 7 7 0.0 1
/admin/help/answer 1.0 1 1 0.0 1
/admin/help/questions 1.0 1 1 0.0 1
/admin/lead/emailList 15.0 6 24 9.0 2
/admin/lead/getScore 17.0 17 17 0.0 1
/admin/lead/phoneList 11.0 8 14 3.0 2
/admin/lead/source/list 7.0 7 7 0.0 1
/admin/lead/tag/list 110.0 110 110 0.0 1
/admin/lead/task/list/withandwithouttemplate 7.0 7 7 0.0 1
/admin/lead/timeline/all 13.0 13 13 0.0 1
/admin/lead/timeline/manual/type/get 7.0 7 7 0.0 1
/admin/lead/timeline/note 185.0 185 185 0.0 1
/admin/lender/list/leadassign 20.0 20 20 0.0 1
/admin/stage/list 14.0 14 14 0.0 1
/admin/team/member/list/valid 21.0 21 21 0.0 1
/admin/virtualNumber/info 8.0 8 8 0.0 1
/admin/vsms/template/list 103.0 103 103 0.0 1
/admin/lead/phoneList 11.0 8 14 3.0 2
标志 | 含义 | 实例 |
---|---|---|
Tag | 访问的路径 | /admin/lead/phoneList |
Avg(ms) | 访问平均耗时 | 11.0 |
Min | 连接访问最小耗时 | 8 |
Max | 连接访问最大耗时 | 14 |
Std Dev | 耗时的标准差 |
3.0 |
Count | 访问的次数 | 2 |
/logs/myibatis_perf/perfStats.log
Performance Statistics 2017-08-03 15:43:40 - 2017-08-03 15:43:50
Tag Avg(ms) Min Max Std Dev Count
Performance Statistics 2017-08-03 15:43:50 - 2017-08-03 15:44:00
Tag Avg(ms) Min Max Std Dev Count
com.homethy.payment.business.dao.contract.TeamMarketPackageDAO.getTeamMarketPackageByTeamId 26.0 26 26 0.0 1
/logs/service_perf/perfStats.log
Performance Statistics 2017-08-03 14:48:30 - 2017-08-03 14:48:40
Tag Avg(ms) Min Max Std Dev Count
com.homethy.business.service.kafka.scheduler.LeadKafkaConsumerScheduler.consume 999.6 999 1000 0.5 5
Performance Statistics 2017-08-03 14:48:40 - 2017-08-03 14:48:50
Tag Avg(ms) Min Max Std Dev Count
com.homethy.business.service.kafka.scheduler.LeadKafkaConsumerScheduler.consume 999.2 999 1000 0.4 5
Performance Statistics 2017-08-03 14:48:50 - 2017-08-03 14:49:00
Tag Avg(ms) Min Max Std Dev Count
com.homethy.business.service.kafka.scheduler.LeadKafkaConsumerScheduler.consume 999.0 999 999 0.0 5
/
/
/
/
\\