使用Logstash

时间:2016-03-02 05:30:04

标签: cmd logstash

发生异常时,我只需从日志中获取一组选定的行。

LOG我需要参与:

[2/24/16 11:31:35:276 SAST] 00000053 BusinessExcep E CNTR0020E:EJB在调用方法期间抛出了意外(未声明的)异常" getCustomerDashBoardCVAHistoricalDataRequestCount" on bean" BeanId(cva-admin-ear#vis-ejb-cva-4.20.0.0-SNAPSHOT.jar#CustomerDashboardServiceBean,null)"。异常数据:java.lang.RuntimeException:com.ibm.websphere.naming.CannotInstantiateObjectException:JNDI NamingManager处理javax.naming.Reference对象时发生异常。 [根异常是com.ibm.websphere.ejbcontainer.AmbiguousEJBReferenceException:短格式默认绑定' za.co.sb.archiving.midtier.ejb.HistoricalDataRequestBusinessServiceRemote'是不明确的,因为多个bean实现了接口:[channel-frontendEAR#channel-biz-ejb-3-4.20.0.0-SNAPSHOT.jar#HistoricalDataRequestBusinessServiceBean,nbol-rest-0_0_1-20150729_102930-10_war #nbol-rest-0.0.1- 20150729.102930-10.war#HistoricalDataRequestBusinessServiceBean。提供特定于接口的绑定或在查找时使用长格式默认绑定。     在za.co.sb.channel.cva.customerdashboard.midtier.pojo.CustomerDashboardVisServicePojo.getRequestBusinessService(CustomerDashboardVisServicePojo.java:355)     在za.co.sb.channel.cva.customerdashboard.midtier.pojo.CustomerDashboardVisServicePojo.getHistoricalDataRequestCount(CustomerDashboardVisServicePojo.java:282)     在za.co.sb.channel.cva.customerdashboard.midtier.pojo.CustomerDashboardVisServicePojo.getCustomerDashBoardHistoricalDataRequestCount(CustomerDashboardVisServicePojo.java:249)     在za.co.sb.channel.cva.customerdashboard.midtier.ejb.CustomerDashboardServiceBean.getCustomerDashBoardCVAHistoricalDataRequestCount(CustomerDashboardServiceBean.java:49)     at za.co.sb.channel.cva.customerdashboard.midtier.ejb.EJSLocal0SLCustomerDashboardServiceBean_7d8a7f63.getCustomerDashBoardCVAHistoricalDataRequestCount(EJSLocal0SLCustomerDashboardServiceBean_7d8a7f63.java)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)     在java.lang.reflect.Method.invoke(Method.java:597)     在za.co.sb.midtier.processservice.ProcessServiceImpl.callService(ProcessServiceImpl.java:770)     在za.co.sb.midtier.processservice.ProcessServiceImpl.retrieveResultData(ProcessServiceImpl.java:1151)     在za.co.sb.midtier.processservice.ProcessServiceImpl.process(ProcessServiceImpl.java:248)     在za.co.sb.midtier.processservice.ProcessServiceBean.process(ProcessServiceBean.java:63)     在za.co.sb.midtier.processservice.EJSRemote0SLCustomerAdminProcessService_450d08b4.process(EJSRemote0SLCustomerAdminProcessService_450d08b4.java)     at sun.reflect.GeneratedMethodAccessor1150.invoke(Unknown Source)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)     在java.lang.reflect.Method.invoke(Method.java:597)     在com.ibm.CORBA.iiop.ClientDelegate $ 3.run(ClientDelegate.java:1266)     at java.security.AccessController.doPrivileged(Native Method)     在com.ibm.CORBA.iiop.ClientDelegate.invoke0(ClientDelegate.java:1263)     在com.ibm.CORBA.iiop.ClientDelegate $ ClientDelegate0.invoke(ClientDelegate.java:1500)     在com.sun.proxy。$ Proxy116.process(未知来源)     在za.co.sb.midtier.processservice._ProcessService_Stub.process(_ProcessService_Stub.java)     在za.co.sb.core.midtier.router.delegates.ModuleDelegate.processData(ModuleDelegate.java:48)     在za.co.sb.core.midtier.router.CoreRouter.doGet(CoreRouter.java:231)     在za.co.sb.core.midtier.router.CoreRouter.doPost(CoreRouter.java:459)     在javax.servlet.http.HttpServlet.service(HttpServlet.java:595)     在javax.servlet.http.HttpServlet.service(HttpServlet.java:668)     在com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1230)     在com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:779)     在com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)     在com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)     在com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136)     在com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:97)     在za.co.sb.core.midtier.router.CoreRouterFilter.doFilter(CoreRouterFilter.java:136)     在com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)     在com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)     在za.co.sb.core.midtier.router.HTTPTokenFilter.doFilter(HTTPTokenFilter.java:78)     在com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)     在com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)     在za.co.sb.core.midtier.router.VerificationFilter.doFilter(VerificationFilter.java:152)     在com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)     在com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)     在com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:960)     在com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1064)     在com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:87)     在com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:909)     在com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)     在com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)     在com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:453)     在com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:515)     在com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:306)     在com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:277)     在com.ibm.ws.ssl.channel.impl.SSLConnectionLink.determineNextChannel(SSLConnectionLink.java:1049)     at com.ibm.ws.ssl.channel.impl.SSLConnectionLink $ MyReadCompletedCallback.complete(SSLConnectionLink.java:643)     at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext $ SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1784)     at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:557)     在com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:607)     在com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:984)     在com.ibm.ws.tcp.channel.impl.WorkQueueManager $ Worker.run(WorkQueueManager.java:1069)     在com.ibm.ws.util.ThreadPool $ Worker.run(ThreadPool.java:1700) 引发者:com.ibm.websphere.naming.CannotInstantiateObjectException:JNDI NamingManager处理javax.naming.Reference对象时发生异常。 [根异常是com.ibm.websphere.ejbcontainer.AmbiguousEJBReferenceException:短格式默认绑定' za.co.sb.archiving.midtier.ejb.HistoricalDataRequestBusinessServiceRemote'是不明确的,因为多个bean实现了接口:[channel-frontendEAR#channel-biz-ejb-3-4.20.0.0-SNAPSHOT.jar#HistoricalDataRequestBusinessServiceBean,nbol-rest-0_0_1-20150729_102930-10_war #nbol-rest-0.0.1- 20150729.102930-10.war#HistoricalDataRequestBusinessServiceBean。提供特定于接口的绑定或在查找时使用长格式默认绑定。     at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookupExt(Helpers.java:1103)     at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookup(Helpers.java:796)     at com.ibm.ws.naming.jndicos.CNContextImpl.processBoundObjectForLookup(CNContextImpl.java:2876)     在com.ibm.ws.naming.jndicos.CNContextImpl.processResolveResults(CNContextImpl.java:3973)     在com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1875)     在com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1776)     在com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1433)     在com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:615)     在com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:165)     在com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:179)     在org.apache.aries.jndi.DelegateContext.lookup(DelegateContext.java:161)     在javax.naming.InitialContext.lookup(InitialContext.java:392)     在za.co.sb.channel.cva.customerdashboard.midtier.pojo.CustomerDashboardVisServicePojo.getRequestBusinessService(CustomerDashboardVisServicePojo.java:352)     ......还有60多个 引起:com.ibm.websphere.ejbcontainer.AmbiguousEJBReferenceException:短格式默认绑定' za.co.sb.archiving.midtier.ejb.HistoricalDataRequestBusinessServiceRemote'是不明确的,因为多个bean实现了接口:[channel-frontendEAR#channel-biz-ejb-3-4.20.0.0-SNAPSHOT.jar#HistoricalDataRequestBusinessServiceBean,nbol-rest-0_0_1-20150729_102930-10_war #nbol-rest-0.0.1- 20150729.102930-10.war#HistoricalDataRequestBusinessServiceBean。提供特定于接口的绑定或在查找时使用长格式默认绑定。     at com.ibm.ws.ejbcontainer.util.AmbiguousEJBRefObjectFactory.getObjectInstance(AmbiguousEJBRefObjectFactory.java:166)     at org.apache.aries.jndi.ObjectFactoryHelper $ 7.run(ObjectFactoryHelper.java:338)     at java.security.AccessController.doPrivileged(Native Method)     在org.apache.aries.jndi.Utils.doWithRestoredPrivileges(Utils.java:157)     at org.apache.aries.jndi.ObjectFactoryHelper.getObjectInstanceUsingObjectFactoryBuilders(ObjectFactoryHelper.java:336)     at org.apache.aries.jndi.ObjectFactoryHelper.doGetObjectInstance(ObjectFactoryHelper.java:136)     at org.apache.aries.jndi.ObjectFactoryHelper.access $ 000(ObjectFactoryHelper.java:60)     at org.apache.aries.jndi.ObjectFactoryHelper $ 1.run(ObjectFactoryHelper.java:98)     at java.security.AccessController.doPrivileged(Native Method)     在org.apache.aries.jndi.Utils.doPrivileged(Utils.java:148)     at org.apache.aries.jndi.ObjectFactoryHelper.getObjectInstance(ObjectFactoryHelper.java:96)     at org.apache.aries.jndi.OSGiObjectFactoryBuilder.getObjectInstance(OSGiObjectFactoryBuilder.java:57)     在javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:283)     at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookupExt(Helpers.java:993)     ......还有72个

过滤器:

filter{
        multiline {
                    pattern => "\[%{DATE}"
                    negate => true
                    what => "previous"
                  }
        grok {

              patterns_dir => "./patterns"
              match => [ "message","%{DATESTAMP} %{WORD:zone}] %{WORD:ID} %{WORD:CLASS}\s* W %{GREEDYDATA:ErrorText} "]
              add_tag => "Warning Detected"
              remove_tag => "_grokparsefailure"
        }
        grok {
              match => [ "message","%{DATESTAMP} %{WORD:zone}] %{WORD:ID} %{WORD:CLASS}\s* E %{GREEDYDATA:ErrorText}"]
              remove_tag => "_grokparsefailure"
              add_tag => "Error Detected"
        }
        grok {
              match => [ "message","%{DATESTAMP} %{WORD:zone}] %{WORD:ID} %{WORD:CLASS}\s* I %{GREEDYDATA:ErrorText}"]
              remove_tag => "_grokparsefailure"
              add_tag => "Information Detected"
        }
        grok {
              match => [ "message","%{DATESTAMP} %{WORD:zone}] %{WORD:ID} %{WORD:CLASS}\s* A %{GREEDYDATA:ErrorText}"]
              remove_tag => "_grokparsefailure"
              add_tag => "Application Detected"
        }
        grok{
            match => ["message", "%{JAVALOGMESSAGE:Error Class}"]
            remove_tag => "_grokparsefailure"s
        }

        if [CLASS] =~ /BusinessExcep/ {
            mutate{
            add_tag => "Sikitan chinna payan"
            }
        } 


}

当没有异常时,我能够成功处理日志,但是当异常发生时,过滤器无法正常工作。因此,为了从GREEDYDATA获得所需的一组行,我该怎么办。有什么方法可以从中获得异常原因吗?

仅限说:

at za.co.sb.channel.cva.customerdashboard.midtier.pojo.CustomerDashboardVisServicePojo.getRequestBusinessService(CustomerDashboardVisServicePojo.java:355)     在za.co.sb.channel.cva.customerdashboard.midtier.pojo.CustomerDashboardVisServicePojo.getHistoricalDataRequestCount(CustomerDashboardVisServicePojo.java:282)     在za.co.sb.channel.cva.customerdashboard.midtier.pojo.CustomerDashboardVisServicePojo.getCustomerDashBoardHistoricalDataRequestCount(CustomerDashboardVisServicePojo.java:249)     在za.co.sb.channel.cva.customerdashboard.midtier.ejb.CustomerDashboardServiceBean.getCustomerDashBoardCVAHistoricalDataRequestCount(CustomerDashboardServiceBean.java:49)     at za.co.sb.channel.cva.customerdashboard.midtier.ejb.EJSLocal0SLCustomerDashboardServiceBean_7d8a7f63.getCustomerDashBoardCVAHistoricalDataRequestCount(EJSLocal0SLCustomerDashboardServiceBean_7d8a7f63.java)

aboVe是异常的主要原因,所以我只能得到这些行,其余的就是这样。请帮忙,无法找到解决方法。表示请告知。

1 个答案:

答案 0 :(得分:0)

创建另一个匹配“由...引起”的grok模式,并将其后的内容放入字段中。看起来在消息之后有一些冒号和括号可以关闭。