Ad Widget

Collapse

Need help with parsing a value out of a log file.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rcollier
    Member
    • Sep 2013
    • 53

    #1

    Need help with parsing a value out of a log file.

    Hello everyone,

    I am attempting to parse a value out of this log file:

    Code:
    [CODE]     1 : dis ql(DOM.TO.MIF) curdepth 
    AMQ8409: Display Queue details.
       QUEUE(DOM.TO.MIF)                       TYPE(QLOCAL)
       CURDEPTH(0)                          
    One MQSC command read.
    No commands have a syntax error.
    All valid MQSC commands were processed.
    5724-H72 (C) Copyright IBM Corp. 1994, 2009.  ALL RIGHTS RESERVED.
    Starting MQSC for queue manager MIF.DOM.IL.QMGR.
    [/CODE]

    The item I've created to do this looks like this:
    Code:
    log[/var/mqm/queue_depth_logs/dom.to.mif.qd.log,"CURDEPTH (([0-9]+))",,,,\1]
    I am trying to get the value between the parenthesis of CURDEPTH (value)

    I must be doing something wrong because the item is not updating in latest data. The agent log doesn't show anything useful.

    Anyone have any advice?
  • rcollier
    Member
    • Sep 2013
    • 53

    #2
    BUMP. Anyone out there have an idea?

    I'm able to get the value between the parenthesis but the opening parenthesis is also being returned.

    Code:
    (9794
    My item now looks like this:

    Code:
    log[/var/mqm/queue_depth_logs/deadletter.log, "CURDEPTH(.*([0-9]+))",,,,\1]

    Comment

    • aib
      Senior Member
      • Jan 2014
      • 1615

      #3
      Create UserParameter on client's side

      Code:
      UserParameter=curdepth, grep "CURDEPTH"  /var/mqm/queue_depth_logs/deadletter.log | tail -1 | awk  '{split($0,a, "[()]"); print a[2]};'
      Then create Item with a key curdepth.

      Does it work for you?
      Sincerely yours,
      Aleksey

      Comment

      • rcollier
        Member
        • Sep 2013
        • 53

        #4
        That's one way to do it. And honestly, probably the best way since the data will be represented in a graph. It still bugs me that I was unable to get it to work how I intended (I'm sure I'm doing something wrong).

        Anyways, thanks for your help. If you don't mind me asking, where did you learn how to filter text like that?

        Comment

        • steveboyson
          Senior Member
          • Jul 2013
          • 582

          #5
          Originally posted by rcollier
          BUMP. Anyone out there have an idea?

          I'm able to get the value between the parenthesis but the opening parenthesis is also being returned.

          Code:
          (9794
          My item now looks like this:

          Code:
          log[/var/mqm/queue_depth_logs/deadletter.log, "CURDEPTH(.*([0-9]+))",,,,\1]
          Don't know if it works but have you tried to escape the first and last paranthesis?
          aka
          Code:
          log[/var/mqm/queue_depth_logs/deadletter.log, "CURDEPTH\(([0-9]+)\)",,,,\1]
          [/QUOTE]

          Comment

          • aib
            Senior Member
            • Jan 2014
            • 1615

            #6
            Originally posted by rcollier
            If you don't mind me asking, where did you learn how to filter text like that?
            I googled it
            I cannot remember all tips and tricks of "awk" - I just have the general idea how it works and googling what I would like to get.
            Sincerely yours,
            Aleksey

            Comment

            • rcollier
              Member
              • Sep 2013
              • 53

              #7
              haha, there's no shame in googling! I'll read up on some awk tips then. Thanks for your help friend.

              Comment

              Working...