Ad Widget

Collapse

String monitoring in Log File

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • techielins
    Junior Member
    • Aug 2015
    • 1

    #1

    String monitoring in Log File

    Hello,

    I'm looking for possible solution to implement log monitoring. I have a app which uses log file /var/log/webapps.log to write the errors occurred.

    Application is based on Java which integrated with a Web UI through API calls. When exceptions occurs, errors will be written to the log file /var/log/webapps.log

    I was able to implement the log file monitoring as per doc



    Expression in the trigger used is like as shown below

    {server01.intraservers.biz:log["/var/log/webapps.log","UN_EXPECTED_ERROR",,20].nodata(600)}=0

    I'm able to get the alert mail when there is string ''UN_EXPECTED_ERROR" in the log file /var/log/webapps.log like as below.

    Trigger: API Failure
    Trigger status: PROBLEM
    Trigger severity: High

    Item values:

    1. API Failure (server01.intraservers.biz:log["/var/log/webapps.log","UN_EXPECTED_ERROR",,20]): 2015-08-26:09:57:04,134 ERROR errorFile:141 - UN_EXPECTED_ERROR

    Original event ID: 93

    The problem is that, with this setup, it only print the line that is corresponding to the string "UN_EXPECTED_ERROR". I need to print next 50 lines as well after the string so that I can see the full exception occurred just like as shown below in the alert mail.

    2015-08-26:09:57:04,134 ERROR errorFile:141 - UN_EXPECTED_ERROR
    java.lang.IllegalStateException: removeAttribute: Session already invalidated at org.springframework.web.method.support.InvocableHa ndlerMethod.invokeForRequest(InvocableHandlerMetho d.java:132)
    at org.springframework.web.servlet.mvc.method.annotat ion.ServletInvocableHandlerMethod.invokeAndHandle( ServletInvocableHandlerMethod.java:104)
    at org.springframework.web.servlet.mvc.method.annotat ion.RequestMappingHandlerAdapter.invokeHandleMetho d(RequestMappingHandlerAdapter.java:749)
    at org.springframework.web.servlet.mvc.method.annotat ion.RequestMappingHandlerAdapter.handleInternal(Re questMappingHandlerAdapter.java:690)
    at org.springframework.web.servlet.mvc.method.Abstrac tHandlerMethodAdapter.handle(AbstractHandlerMethod Adapter.java:83)
    at org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:945)

    Could someone please advise how to achieve this ?
  • BDiE8VNy
    Senior Member
    • Apr 2010
    • 680

    #2
    The only way I could think of is using Simple macros, as used in building trigger expressions in the action message body. But that works only when hard coding the host name of the item in question within the simple macro.

    See ZBXNEXT-1428 and consider to vote for it.

    Comment

    Working...