免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1691 | 回复: 4
打印 上一主题 下一主题

[文本处理] 取时间段内日志 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2016-12-07 11:50 |只看该作者 |倒序浏览
本帖最后由 wz64050010 于 2016-12-07 15:02 编辑

麻烦请问 想取一段时间内的日志 catalinna.out
时间类型为2016-12-02 10:50,想三分钟一取。。里面有java抛的异常 请教应该怎么写?用sed 匹配发现有的时候没有起始时间点的日志会打不出来 请教各位大神


大致数据为:

2016-12-02 10:42:07,972 [http-apr-8080-exec-11] INFO  c.h.o.services.ApplyDataTempService method=ApplyDataTempService.getPersonalInfoF
romTemp(..) thirdUserId=793, apply_id=300015 - {cost_time=0, args_params=[{"id":803,"tUserId":793,"applyId":300015,"applyType":"2","isVail":"Y
","createPre":"xloan3_web","createDate":"Dec 1, 2016 7:43:50 PM","updatePre":"xloan3_web","updateDate":"Dec 1, 2016 7:45:03 PM","applyDataJson
":"{\"chiName\":\"刘婷婷\",\"idCardNum\":\"210682199205112768\",\"marriageState\":\"MARRIED\",\"province\":\"110000\",\"city\":\"110100\",\"ar
ea\":\"110108\",\"liveAddr\":\"清河街道\",\"incomeRange\":\"FIVETOONE\",\"hasEstate\":\"Y\",\"hasCar\":\"N\",\"degree\":4}"}], return=[{"chiNa
me":"刘婷婷","idCardNum":"210682199205112768","marriageState":"MARRIED","province":"110000","city":"110100","area":"110108","liveAddr":"清河街
道","incomeRange":"FIVETOONE","hasEstate":"Y","hasCar":"N","degree":4}]}
2016-12-02 10:42:07,973 [http-apr-8080-exec-11] INFO  c.h.o.services.LoanMaterialService method=LoanMaterialService.findIdCardInfo(..)
thirdUserId=793, apply_id=300015 - {cost_time=16, args_params=[null,793,300015], return=[{"idCard":"210682199205112768","realName":"刘婷婷","
proStatus":3,"marriageState":"MARRIED"}]}
2016-12-02 10:42:07,973 [http-apr-8080-exec-11] INFO  c.h.o.c.LoanMaterialController method=LoanMaterialController.findIdCardInfo(..)
thirdUserId=793, apply_id=300015 - {cost_time=17, args_params=[], return=[{"status":"20000","message":"success","data":{"idCard":"210682199205
112768","realName":"刘婷婷","proStatus":3,"marriageState":"MARRIED"}}]}
2016-12-02 10:42:12,924 [http-apr-8080-exec-2] INFO  c.h.o.c.LoanMaterialController method=LoanMaterialController.getCompanyIndustryLi
st() thirdUserId=793, apply_id=300015 - start
2016-12-02 10:42:12,924 [http-apr-8080-exec-2] INFO  c.h.o.services.LoanMaterialService method=LoanMaterialService.getCompanyIndustryL
ist() thirdUserId=793, apply_id=300015 - start
2016-12-02 10:42:12,924 [http-apr-8080-exec-2] INFO  c.h.o.services.LoanMaterialService method=LoanMaterialService.getCompanyIndustryL
ist() thirdUserId=793, apply_id=300015 - {cost_time=0, args_params=[], return=[[{"code":"1","msg":"制造业"},{"code":"2","msg":"批发业"},{"code
":"3","msg":"零售业"},{"code":"4","msg":"餐饮业"},{"code":"5","msg":"软件及咨询服务"},{"code":"6","msg":"建筑工程"},{"code":"7","msg":"物流运
输"},{"code":"8","msg":"住宿及旅游"},{"code":"9","msg":"政府及事业单位"},{"code":"10","msg":"金融业"},{"code":"11","msg":"其他"}]]}
2016-12-02 10:42:12,924 [http-apr-8080-exec-2] INFO  c.h.o.c.LoanMaterialController method=LoanMaterialController.getCompanyIndustryLi
st() thirdUserId=793, apply_id=300015 - {cost_time=0, args_params=[], return=[{"status":"20000","message":"success","data":[{"code":"1","msg":
"制造业"},{"code":"2","msg":"批发业"},{"code":"3","msg":"零售业"},{"code":"4","msg":"餐饮业"},{"code":"5","msg":"软件及咨询服务"},{"code":"6",
"msg":"建筑工程"},{"code":"7","msg":"物流运输"},{"code":"8","msg":"住宿及旅游"},{"code":"9","msg":"政府及事业单位"},{"code":"10","msg":"金融业
"},{"code":"11","msg":"其他"}]}]}
2016-12-02 10:42:14,707 [http-apr-8080-exec-6] INFO  c.h.o.c.CreditAuthController method=CreditAuthController.creditAuthTaoBao(..) thi
rdUserId=821, apply_id=300040 - start

2016-12-02 10:46:37,203 [taskExecutor-5] ERROR c.h.o.services.OnlineLoanSignService   - 签署合同错误,发生异常,userId={},applyId={},agr
eementType={}
java.lang.NullPointerException: null
        at java.lang.String.replace(String.java:2240)
        at com.houbank.onlinecredit.services.OnlineLoanSignService.replacePhaseTemplateValue(OnlineLoanSignService.java:600)
        at com.houbank.onlinecredit.services.OnlineLoanSignService.signContract(OnlineLoanSignService.java:174)
        at com.houbank.onlinecredit.services.OnlineLoanSignService$$FastClassBySpringCGLIB$$66c70d76.invoke(<generated>
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:717)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
        at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85)
        at com.houbank.onlinecredit.aspectj.AbstractLogAspect.logMethodArgsReturn(AbstractLogAspect.java:74)
        at com.houbank.onlinecredit.aspectj.ServiceLogAspect.notifyCreditAccountStatusFail(ServiceLogAspect.java:21)
        at sun.reflect.GeneratedMethodAccessor89.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:49
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
        at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:6
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:16
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653)
        at com.houbank.onlinecredit.services.OnlineLoanSignService$$EnhancerBySpringCGLIB$$77c83aa6.signContract(<generated>
        at com.houbank.onlinecredit.services.LoanAuditService.signInsContract(LoanAuditService.java:376)
        at com.houbank.onlinecredit.services.LoanAuditService.sendEContractInfo(LoanAuditService.java:301)
        at com.houbank.onlinecredit.services.LoanAuditService$$FastClassBySpringCGLIB$$e57b19a9.invoke(<generated>
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:717)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
        at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85)
        at com.houbank.onlinecredit.aspectj.AbstractLogAspect.logMethodArgsReturn(AbstractLogAspect.java:74)
        at com.houbank.onlinecredit.aspectj.ServiceLogAspect.notifyCreditAccountStatusFail(ServiceLogAspect.java:21)
        at sun.reflect.GeneratedMethodAccessor89.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)


类似这种

论坛徽章:
28
15-16赛季CBA联赛之八一
日期:2016-02-22 19:10:4215-16赛季CBA联赛之深圳
日期:2016-12-01 10:34:0415-16赛季CBA联赛之新疆
日期:2016-12-07 10:24:2915-16赛季CBA联赛之同曦
日期:2016-12-15 12:06:43CU十四周年纪念徽章
日期:2016-12-18 13:03:4415-16赛季CBA联赛之吉林
日期:2017-01-03 15:52:2515-16赛季CBA联赛之辽宁
日期:2017-01-04 14:58:2415-16赛季CBA联赛之辽宁
日期:2017-01-15 09:42:512016科比退役纪念章
日期:2017-02-06 17:21:50黑曼巴
日期:2017-02-10 15:46:1215-16赛季CBA联赛之上海
日期:2017-03-18 10:14:5415-16赛季CBA联赛之青岛
日期:2017-03-18 22:00:44
2 [报告]
发表于 2016-12-07 11:56 |只看该作者

日志数据能发一下吗

论坛徽章:
0
3 [报告]
发表于 2016-12-07 13:42 |只看该作者
什么格式的数据呀

论坛徽章:
28
15-16赛季CBA联赛之八一
日期:2016-02-22 19:10:4215-16赛季CBA联赛之深圳
日期:2016-12-01 10:34:0415-16赛季CBA联赛之新疆
日期:2016-12-07 10:24:2915-16赛季CBA联赛之同曦
日期:2016-12-15 12:06:43CU十四周年纪念徽章
日期:2016-12-18 13:03:4415-16赛季CBA联赛之吉林
日期:2017-01-03 15:52:2515-16赛季CBA联赛之辽宁
日期:2017-01-04 14:58:2415-16赛季CBA联赛之辽宁
日期:2017-01-15 09:42:512016科比退役纪念章
日期:2017-02-06 17:21:50黑曼巴
日期:2017-02-10 15:46:1215-16赛季CBA联赛之上海
日期:2017-03-18 10:14:5415-16赛季CBA联赛之青岛
日期:2017-03-18 22:00:44
4 [报告]
发表于 2016-12-07 16:02 |只看该作者

  1. awk -F, '/^[0-9]+-/{if($1>="2016-12-02 10:42"&&$1<"2016-12-02 10:45")f=1;else f=0}f' file
复制代码

?

论坛徽章:
0
5 [报告]
发表于 2016-12-08 12:09 |只看该作者
回复 4# moperyblue

好像是ok了!多谢大神
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP