OnDemand User Group

Support Forums => MP Server => Topic started by: jsquizz on November 30, 2021, 08:40:33 AM

Title: Best way to query system log using UTC date?
Post by: jsquizz on November 30, 2021, 08:40:33 AM
Hi Folks,

I am writing a simple script that captures some daily activity from the system log, using arsdoc query.

In dealing with the system log storing the date in UTC format so here's a quick snippet of my plan:

Code: [Select]
YESTERDAY=`something that generates yesterdays date`
2DAYSAGO=`somethinh that generates 2 days ago`

Now, throwing it into arsdoc query, my plan is this, example is - capturing 88 records for 11/29/21 Server Time-

Code: [Select]
"-i "where ODDAT_LOAD_DATE BETWEEN '$2DAYSAGO.16.59.59' and $YESTERDAY.16.59.59'"
Trying that approach and I am getting this error

Code: [Select]
DB Error: [IBM][CLI Driver][DB2/AIX64] SQL0180N  The syntax of the string representation of a datetime value is incorrect.  SQLSTATE=22007  -- SQLSTATE=22007, SQLCODE=-180, File=arsdoc.c, Line=3563
Does anyone have a handy way of getting things from the system log for the previous day, from a monitoring script, report, etc..?

Thanks!
Title: Re: Best way to query system log using UTC date?
Post by: Justin Derrick on December 02, 2021, 01:06:16 PM
Make sure the date format you're sending to the SQL statement matches the date format that DB2 can easily recognize:  YYYY-MM-DD-HH.MM.SS.FFFFFF  (where FFFFFF is a six-digit fraction of a second).

You may want to investigate using SQL's built-in functions like current timestamp and days to create your

-JD.