服务限流的限流日志打印在 ${user.name}/logs/guardian
中,包括默认日志、运行错误日志和限流统计日志。
默认日志
服务限流的默认日志是打印在 guardian/guardian-default.log
中,主要打印推送过来的限流配置信息,日志内容没有固定格式。日志样例如下:
2016-12-1219:49:09,610 INFO RegistringGuardianCodeWrapperInterceptor
2016-12-1219:49:10,757 WARN receive message with key=[guardianConfig]and value=[{"@type":"com.alipay.guardian.client.drm.GuardianConfig","engineConfigs":{"@type":"java.util.HashMap","LIMIT":{"@type":"com.alipay.guardian.client.engine.limit.LimitEngineConfig","actionConfigMap":{"@type":"java.util.HashMap",880:{"@type":"com.alipay.guardian.client.engine.limit.LimitActionConfig","actionType":"LIMIT_EXCEPTION","id":880,"responseContent":"限流配置-接口-多计算模型-抛出异常"}},"globalConfig":{"enable":true,"runMode":"CONTROL"},"resourceConfigList":[{"baseName":"com.alipay.guardiantestsofalite.facade.GuardianTestTrServiceFacade.testLimitBasicCondition","id":379,"resourceType":"METHOD","ruleIds":[880]}],"ruleConfigMap":{"@type":"java.util.HashMap",880:{"@type":"com.alipay.guardian.client.engine.limit.LimitRuleConfig","actionId":880,"calculationConfigs":[{"calculationType":"INVOKE_BY_TIME","maxAllow":10,"period":5000},{"calculationType":"INVOKE_BY_TIME","maxAllow":10,"period":5000},{"calculationKey":"[0].booleanValue","calculationType":"INVOKE_BY_TIME_CATEGORY","period":5000,"tairCompareKey":"true>5,false>6"}],"enable":true,"extParamConfigs":[],"id":880,"limitType":"GENERIC_LIMIT","paramConfigs":[{"checkMode":"BYVALUE","compare":"EQUALS","key":"[0].stringValue","value":"testStrMutilBasicParams"},{"checkMode":"BYVALUE","compare":"EQUALS","key":"[1].stringValue","value":"MultileCalculations"}],"paramRelation":"AND","ruleBizId":"[tr]限流配置-接口-基本参数多项-多个计算模型","runMode":"CONTROL","trafficType":"all"}}},"FUSE":{"@type":"com.alipay.guardian.client.engine.fuse.FuseEngineConfig","actionConfigMap":{"@type":"java.util.HashMap"},"ruleConfigMap":{"@type":"java.util.HashMap"}}},"version":1}]
2016-12-1219:49:10,759 WARN after update with key=[guardianConfig]
2016-12-1219:49:11,195 INFO GuardianConfig version=1
2016-12-1219:49:11,197 WARN rebuild Rules,GuardianFactory:class com.alipay.guardian.client.limit.LimitGuardianFactory
运行错误日志
服务限流的运行时错误日志打印在 guardian/guardian-error.log
中,主要打印一些错误信息,其中的错误堆栈信息需要重点关注,日志内容没有固定格式。
限流统计日志
服务限流的限流统计日志是 guardian/guardian-limit-stat.log
,日志内容为固定格式。日志样例如下:
2016-11-2100:00:02,001 INFO MONITOR,43,test,1000,2016-11-21T00:00:01,2016-11-21T00:00:02,INVOKE_BY_TIME,10,40,10,30
示例值对应说明如下:
示例值 | 说明 |
2016-11-2100:00:02 | 日志打印时间。 |
001 | 请求耗时,单位:ms。 |
INFO | 日志等级,取值为:INFO、DEBUG、ERROR、WARN。 默认为:INFO。 |
MONITOR | 限流模式,取值如下:
|
43 | 限流规则 ID。 |
test | 限流规则名称。 |
1000 | 统计间隔。 |
2016-11-21T00:00:01 | 本次统计的开始时间。 |
2016-11-21T00:00:02 | 本次统计的结束时间。 |
INVOKE_BY_TIME | 统计类型。 |
10 | 限流规则阈值。 |
40 | 限流周期内的总请求数。 |
10 | 限流周期内的放行请求数。 |
30 | 表示当前限流周期内被限流的请求数。 |
文档内容是否对您有帮助?