|
lotsaram wrote: Thu Jan 19, 2012 8:17 am wilsonric wrote:The ability to record the last date a client logged in to TM1 would be very useful from a client/licence management perspective. Bedrock.Server.UserLogins.pro (Note I don't know if this has been officially added to bedrock, as I have adopted bedrock as a standard set of utilities I just adopted the naming and coding conventions ...) All you need to do is run the caller process, it will automatically create the logging cube (need to run it 2x to initially set up the metadata). Then ongoing schedule the caller process in a chore to run daily and process the last 1 or 2 days only of tm1s logging output (assuming there is at least a daily SaveDataAll.) If there is no change to naming conventions vs. the default param values then after the process has run you can get clients ordered by last login date with the following MDX. Code: {ORDER( {TM1SUBSETALL( [}Clients] )}, [SYS_UserProperties].([SYS_UserProperties_M].[Last Login Ordinal]), BDESC )} Obviously the last login is only as current as 1/ the last time the process was run and 2/ the last time a save data was done. However for the purposes of compliance and tracking which users haven't accessed the system it is quite adequate. Thank you for the code. You made my life easy.I noticed that the log timestamp is GMT (as per IBM this cannot be changed within the file. Please correct me if I am wrong. NOTE: Changing the log4j.appender.S1.TimeZone to LOCAL will not change what's in the actual log file on disk. This is always recorded in GMT. It does change the times to local time when you view the log file via Architect. Source: https://www-01.ibm.com/support/docview. ... wg21459102 ).I modified the code in Bedrock.Server.UserLogins.pro with following changes and I noticed that when I ASCIIOUTPUT the data, only the first line get the timezone conversion applied Code: sTimeStamp =SubSt(vTimeStamp, 1, 4) |'-'| SubSt(vTimeStamp, 5, 2) |'-'| SubSt(vTimeStamp, 7, 2) |' '| SubSt(vTimeStamp, 9, 2) |':'| SubSt(vTimeStamp, 11, 2) |':' | SubSt(vTimeStamp, 13, 2) ; nDateTime = ParseDate ( sTimeStamp, 'yyyy-MM-dd h:m:s' ) ; NewDateFormatter ( 'en_au', 'Australia/Sydney', 'serial', 'medium', 'datetime' ) ; sDateTimeAU = FormatDate ( nDateTime, 0 ) ; ASCIIOUTPUT ( 'date.txt',sTimeStamp, NumberToString ( nDateTime ) ,sDateTimeAU ) ; Source: https://exploringtm1.com/date-time-functions-tm1-10-2/ASCIIOUTPUT Code: "2019-12-04 03:37:10","21887.150810185","04/12/2019 2:37:10 PM" "2019-12-04 03:37:10","21886.692476852","2019-12-04 3:37:10" Sourcefile: tm1s*.log file I am loading has 2 login records as below.Code: "","20191204033710","20191204033710","*","S","ACTIVE","","}ClientProperties","CAMID(""TMB:u:b98a4f20c97a33429de8405f91fc5948"")","STATUS","" "","20191204033710","20191204033710","*","S","","ACTIVE","}ClientProperties","CAMID(""TMB:u:b98a4f20c97a33429de8405f91fc5948"")","STATUS","" The SYS_Userproperties cube has "2019-12-04 3:37:10" stamped against the user. Any idea what I am doing wrong. (责任编辑:) |
