DX Infrastructure Manager

Expand all | Collapse all

Logmon: Monitor a timestamp in a log-file?

  • 1.  Logmon: Monitor a timestamp in a log-file?

    Posted 06-16-2017 04:34 AM

    Is it possible to monitor a timestamp to match today or yesterdays date ?



    Total Space of File System (MB): 1,048,446
    Space Used on File System(MB): 598,974
    Space Used by Database(MB): 598,080
    Free Space Available (MB): 449,472
    Total Pages: 62,900,295
    Usable Pages: 62,899,519
    Used Pages: 56,846,039
    Free Pages: 6,053,480
    Buffer Pool Hit Ratio: 99.7
    Total Buffer Requests: 31,708,875,508
    Sort Overflows: 0
    Package Cache Hit Ratio: 99.9
    Last Database Reorganization: 06/16/2017 09:13:26
    Full Device Class Name: DBB
    Number of Database Backup Streams: 2
    Incrementals Since Last Full: 0
    Last Complete Backup Date/Time: 06/15/2017 21:00:00
    Compress Database Backups: Yes
    Protect Master Encryption Key: No

  • 2.  Re: Logmon: Monitor a timestamp in a log-file?

    Broadcom Employee
    Posted 06-16-2017 08:37 AM

    Hi Thorin, you might want to check out the dirscan probe instead.

    It monitors files/directories for things like number of files, age of file, etc.

    Check out the link above to see what all you can do with dirscan.


    Hope that helps!

  • 3.  Re: Logmon: Monitor a timestamp in a log-file?

    Posted 06-16-2017 10:33 AM

    Hi Philip,


    I think Dirscan is only for directory scanning, not for monitor inside the files/logs. 

  • 4.  Re: Logmon: Monitor a timestamp in a log-file?

    Posted 06-16-2017 09:20 PM

    What if you used SQL instead of the "q" output:




    Will (should) give you the last date. Perhaps something like




    Might give you a number that you could use to measure how long ago the backup happened.


    I don;t have a TSM server readily available to try it out.



  • 5.  Re: Logmon: Monitor a timestamp in a log-file?

    Posted 07-31-2017 08:24 AM

    So this was the way I solved this.

    Changed the query in the report to:

    select last_backup_date from db where last_backup_date>current_timestamp - 30 hours

    If no backup was started the last 30 hours we will get this output:

    ANR2034E SELECT: No match found using this criteria.
    ANS8001I Return code 11.


    And if there was a backup the last 30 hours, we will get this:

    2017-07-30 21:00:02.000000

    Thx for the help, Garin!

  • 6.  Re: Logmon: Monitor a timestamp in a log-file?

    Posted 06-21-2017 03:53 AM

    Hi Garin,


    Well, for now I don't have access to the TSM. Only a log-file which is generated from the TSM.

    Do you know any other options to check a timestamp, when not able to query the TSM itself?

  • 7.  Re: Logmon: Monitor a timestamp in a log-file?

    Posted 06-21-2017 09:24 AM

    Were I faced with this task I'd look to doing this evaluation using a local OS command. It's not clear if you are running logmon on Windows or Linux but in both cases there's plenty of information on doing date math. So assuming Unix/Linux/AIX I'd start with something like "logdate=$(grep 'Last Complete Backup Date/Time' log.txt | tail -1 | cut -d: -f 2-)"


    Then depending on your flavor of Linux, use date to calculate the number of seconds since epoch for $logdate and the current date. Then use bc to calculate the difference. Then use logmon to run that command and compare the seconds returned to your threshold using the expected value in the variables list.


    Something similar could be done with powershell on Windows.



  • 8.  Re: Logmon: Monitor a timestamp in a log-file?

    Posted 06-22-2017 08:24 AM

    Sorry, not Linux or AIX

    I'm working on Windows OS. The TSM-admin are generating a log (.txt-file) that ends up on a Windows Server, which I monitor with UIM (Logmon right now).

  • 9.  Re: Logmon: Monitor a timestamp in a log-file?

    Posted 06-24-2017 03:56 PM

    Hi Rith,


    What do you want to do exactly with the timestamp ? If you want to get the timestamp in your logfile, a logmon profile in update mode will do the work.


    Match on regex : Last Complete Backup Date\/Time:\s(.*)


    So now you can create a QOS on regex match position 1 and do what you want with this QOS ( Report etc.. ) 


    Best Regards,


  • 10.  Re: Logmon: Monitor a timestamp in a log-file?

    Posted 10-12-2017 08:44 AM

    Not sure if this helps in your situation or not but I use the script below to monitor an Excel file for a matching date but to give me 10 days notice.


    This script will need hacking to suit your needs, but the theory is there.


    a = alarm.get()

    message = "Certificate Expiry Alert"
    SUPPKEY = "Certificate_Expiry"
    SUBSYS = "1.1"
    SOURCE = ""

    -- Settings
    local allowed_age = 20160 -- In minutes

    -- Input line (for testing only)
    --local inputstr = "DOMAIN\\USERNAME,Web Server (WebServer),13/01/2017 09:13,13/01/2019,COMPANY_NAME,HOSTNAME_FQDN,SITE"

    -- Separate line into 7 variables by token ","
    local path, server, time, date, company_name, hostname, site = string.match(a.message, "([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+)")

    -- Check, if the line is ok (not necessary, but should be here to handle possible errors)
    -- Also note, some additional checks could be here (eg. regex to match DD/MM/YYYY format)
    --if date == nil then
    --nimbus.alarm (1, message , SUPPKEY , SUBSYS , SOURCE)
    --print("Error reading line: "..a.message)

    -- Get current time minus 9000 minutes (in format DD/MM/YYYY)
    local target_date = os.date("%d/%m/%Y", os.time() + allowed_age * 60)

    -- Printing what we got (for testing)
    print("Target date: "..target_date..", Input date: "..date)

    -- Testing the match
    if target_date == date then
    nimbus.alarm (2, a.message , SUPPKEY , SUBSYS , SOURCE)
    -- print("Dates are matched!")
    print("Dates are not matched!")

  • 11.  Re: Logmon: Monitor a timestamp in a log-file?

    Posted 10-26-2017 07:28 AM

    You could also use these two scripts, and quite probably put them into one..


    First part:


    --get the system current date

    dd = os.date('%Y-%m-%d')

    --gets alarm

    a = alarm.get ()


    --creates alert with two dates

    nimbus.alarm (1,""..a.message.." "..dd.."")


    Second Part:


    SUBSYS = "1.1"
    SOURCE = ""

    a = alarm.get ()

    if (string.match(a.message, "^(%d+%-%d+%-%d+) %- %1$")) then


    nimbus.alarm (5,"Date mis-match detected - "..a.message.." Any additional message text", SUPPKEY, SUBSYS, SOURCE)



    The second script compares the dates and if they match it takes no action (prints), if they do not match it alerts.  So you can play with this in either situation.