Smarts: How do I change the date/time format used in Smarts?; How can I configure Smarts to log time in the 12 hour format rather than the 24 hour format?
search cancel

Smarts: How do I change the date/time format used in Smarts?; How can I configure Smarts to log time in the 12 hour format rather than the 24 hour format?

book

Article ID: 306619

calendar_today

Updated On:

Products

VMware Smart Assurance

Environment

VMware Smart Assurance - SMARTS
VMware Smart Assurance - NCM

Resolution

How do I change the date/time format used in Smarts?
How can I configure Smarts to log time in the 12 hour format rather than the 24 hour format?

How can the date and time format in Smarts logging be changed?

Smarts: How can I change the time and date stamp formats in Smarts log files?




How do I change the date/time format used in Smarts, do the following:

  1. Open the runcmd_env.sh file found here for editing:

    <BASEDIR>/smarts/local/conf/runcmd_env.sh

     
  2. Use SM_DATETIME_FORMAT for Internationalized versions (DMT 9 based) to specify the format you want. The allowed values are the following:

    SI_DAT_FULL
    SI_DAT_LONG
    SI_DAT_MEDIUM
    SI_DAT_SHORT
    SI_DAT_LOCALE_NEUTRAL
    SI_DAT_UTC SI_DAT_ISO8601
    SI_DATETIME_FORMAT
    SI_DAT_CUSTOM

    See the following section for examples of these format values.

Examples

SM_DATETIME_FORMAT=SI_DAT_LOCALE_NEUTRAL 
1969/12/31 20:00:42

SM_DATETIME_FORMAT=SI_DAT_SHORT   
31/12/69 20:00

SM_DATETIME_FORMAT=SI_DAT_MEDIUM  
31 d©c. 1969 20:00:42

SM_DATETIME_FORMAT=SI_DAT_LONG   
31 d©cembre 1969 20:00:42 HMG-05:00

SM_DATETIME_FORMAT=SI_DAT_FULL   
mercredi 31 d©cembre 1969 20:00:42 tats-Unis (New York)

SM_DATETIME_FORMAT=SI_DAT_DEFAULT   
31 d©cembre 1969 20:00:42 HMG-05:00

SM_DATETIME_FORMAT=   
31 d©cembre 1969 20:00:42 HMG-05:00

SM_DATETIME_FORMAT=bogus   
31 d©cembre 1969 20:00:42 HMG-05:00

SM_DATETIME_FORMAT=SI_DAT_UTC   
1970/01/01 01:00:42

SM_DATETIME_FORMAT=SI_DAT_ISO8601   
1970-01-01T01:00:42.000Z

SM_DATETIME_FORMAT=SI_DAT_CUSTOM (see Notes)
SM_FORMAT_DATETIME="%d-%b-%Y %X %p %Z"
18-Jun-2012 08:16:16 AM EDT



Additional Information

In Foundation 9.0 the ability to use  SM_DATETIME_FORMAT=SI_DAT_CUSTOM was removed.  In Smarts version 9.1 this functionality has been added for English only locales.

From the 9.1 release notes:

In earlier releases, the SM_FORMAT_DATETIME environment variable was used to specify the format of timestamps in the log files. Because of internationalization changes, support for the format was dropped in Foundation 9.0. This resulted in changes of how date and time were written to the log files and in turn affected custom parsing scripts implemented by some users.

To fix the issue, a date and format mode is added back (in 9.1) which recognizes the old SM_FORMAT_* environment variables and outputs the date and time in the requested formats. Because the formats are only meaningful under English locales, it is recommended not to use them in favor of the other date time formats supported on Foundation 9.0.


%d represents day of the month(0-31),
%b represents Abbreviated month name(such as Aug),
%Y represents Year(2012),
%Z represents Timezone name(Indian Standard Time),
%H represent Hour in 24 hour format(00-23),
%X represents Time representation(hh:min:sec).