Notifications

31 views

Description

While trying to use Syslog probe to send log data to an external log system the resultant message could have a localised timestamp which is in the wrong language for the target system failing to send the message.

Release or Environment

Any

Cause

The mid server will use one or another locale configuration depending on the local configuration of the server, if default locale is not the same as the target log systems expects that could cause issues.

In order to confirm this issue you can go to " MID Server > Background Script > Scripts - Background" and run the following script. This will run on the MID Server and return the results:

var stampDatetime = new Packages.java.util.Date();
var stampTimeZone = Packages.java.util.TimeZone.getTimeZone("GMT");
ms.log(stampTimeZone);

stampTimeZone = Packages.java.util.TimeZone.getDefault();
ms.log(stampTimeZone);

var stamp = new Packages.java.util.GregorianCalendar(stampTimeZone);
stamp.setTime(stampDatetime);
ms.log(stamp);

var sdf = new Packages.java.text.SimpleDateFormat("MMM dd HH:mm:ss");
sdf.setCalendar(stamp);
sdf.setTimeZone(stamp.getTimeZone());
var ts = sdf.format(stamp.getTime());

ms.log(ts);


The result would contain a timestamp on the locale on the MID. For example a system with Finnish as main language would give a result containing a date as follows:

*** Script: kesäkuuta 18 02:58:44

Resolution

Follow the next steps to force the MID server to use an specific locale as needed:

1. Make sure that the needed locale is installed on the MID system (English for this example). If not install it before continuing and make it the first option in the list.
2. Stop the MID and add the below property to wrapper-override.conf:

wrapper.lang=en_US

3. Save the file and start the MID.
4. Repeat previous test and confirm date comes in English.

Article Information

Last Updated:2020-06-22 10:09:57
Published:2020-06-22