Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2010
    Posts
    207

    Unanswered: Looking for a DB2 Script to cut off DB2DIAG.LOG File

    Hello Guys,

    how are you doing? I am looking for a script that cuts off my DB2diag.log file ... ( e.g. after 5000 or 10.000 rows )

    I know there is the diagsize option ... but we have a Nagios Monitoring which checks db2diag.log file only.

    Thanks for your support in advance.

    Kind regards,

    DB_N00b

  2. #2
    Join Date
    Jul 2013
    Location
    Moscow, Russia
    Posts
    666
    Provided Answers: 55
    Hello,

    try this:
    [[ $(db2diag -c | cut -d' ' -f2) -ge 5000 ]] && db2diag -A
    Regards,
    Mark.

  3. #3
    Join Date
    Jan 2009
    Location
    Zoetermeer, Holland
    Posts
    746
    Quote Originally Posted by mark.b View Post
    [[ $(db2diag -c | cut -d' ' -f2) -ge 5000 ]] && db2diag -A
    Nice Never used the '-c' option before. You count the entries, topic-starter mentions 'rows'... hard to define in the db2diag log file.

    Maybe it is useful to look look at the size of the db2diag file. I had a customer once (db2v8 on win2003) and when the db2diag file reached 4Gb the system just froze!!!
    Do not know if that is still the case but since then I never allow that file to grow that big.
    Somewhere between " too small" and " too large" lies the size that is just right.
    - Scott Hayes

  4. #4
    Join Date
    Jul 2013
    Location
    Moscow, Russia
    Posts
    666
    Provided Answers: 55
    This would count rows:
    db2diag | wc -l
    Actually I'm not sure if I got the requirements correctly.
    It's not clear if Nagios Monitoring requires only the latest 5000 records/rows from the db2diag.log or it's just OK to prune periodically the db2diag.log as 'db2diag -A' does it...
    Regards,
    Mark.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •