unix - how to grep the error line and error caused by line -


i need grep error.log file *error* , caused by: same error tag in next-next lines

for example: have error.log following

08.02.2016 00:11:21.541 *error* [158.151.84.34 [1454908281309] /content/user/home/people-search.html http/1.1] com.day.cq.wcm.tags.includetag error while executing script content.jsp org.apache.sling.api.scripting.scriptevaluationexception:         @ org.apache.sling.scripting.core.impl.defaultslingscript.call(defaultslingscript.java:388)         @ org.apache.sling.scripting.jsp.taglib.includetaghandler.dispatch(includetaghandler.java:59)         @ org.apache.sling.scripting.jsp.taglib.abstractdispatchertaghandler.doendtag(abstractdispatchertaghandler.java:129)         @ org.apache.jsp.libs.foundation.components.parsys.parsys_jsp._jspservice(parsys_jsp.java:318)         @ org.apache.sling.scripting.jsp.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:502)         ... 180 common frames omitted caused by: org.apache.sling.api.slingexception: javax.servlet.servletexception: java.lang.exception: user person search not available 08.02.2016 05:28:56.748 *error* [158.151.84.34 [1454927336516] /content/user/home/people-search.html http/1.1] org.apache.sling.engine.impl.slingrequestprocessorimpl service: uncaught slingexception org.apache.sling.scripting.jsp.jasper.runtime.httpjspbase.service(httpjspbase.java:70)         @ javax.servlet.http.httpservlet.service(httpservlet.java:725)         @ org.apache.sling.scripting.jsp.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:502)         ... 20 common frames omitted caused by: java.lang.exception: user person search not available 08.02.2016 06:11:24.725 *error* [158.151.84.34 [1454908281309] /content/user/home/people-search.html http/1.1] com.day.cq.wcm.tags.includetag error while executing script content.jsp org.apache.sling.api.scripting.scriptevaluationexception:         @ org.apache.sling.scripting.core.impl.defaultslingscript.call(defaultslingscript.java:388)         ... 10 common frames omitted caused by: org.apache.sling.api.slingexception: javax.servlet.servletexception: java.lang.exception: user person search not available 

i need output as

08.02.2016 00:11:21.541 *error* [158.151.84.34 [1454908281309] /content/user/home/people-search.html http/1.1] com.day.cq.wcm.tags.includetag error while executing script content.jsp caused by: org.apache.sling.api.slingexception: javax.servlet.servletexception: java.lang.exception: user person search not available 08.02.2016 05:28:56.748 *error* [158.151.84.34 [1454927336516] /content/user/home/people-search.html http/1.1] org.apache.sling.engine.impl.slingrequestprocessorimpl service: uncaught slingexception caused by: java.lang.exception: user person search not available 08.02.2016 06:11:24.725 *error* [158.151.84.34 [1454908281309] /content/user/home/people-search.html http/1.1] com.day.cq.wcm.tags.includetag error while executing script content.jsp caused by: org.apache.sling.api.slingexception: javax.servlet.servletexception: java.lang.exception: user person search not available 

how this?

how about:

grep -e "\*error\*" -e "caused by:" error.log 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -