Technote (troubleshooting)
Problem(Abstract)
Fail to parse date string error in non-'C' locale for datetotime() function in rules file.
Symptom
Steps on recreating the symptoms:
-edit probe rule file with the following lines:
$tmp_time = "Tue DEC 19 18:33:11 JST 2010"
$date= datetotime ($tmp_time,"%a %b %e %T %Y")
log(debug,"string " + $tmp_time + " to " + $date)
- set locale to ja_JP on probe host,
- start the ObjectServer,
- start the probe.
The following message is written to the probe debug log file, and the string is not converted correctly:
2011-03-24T11:08:49: Error: E-ETC-102-036: Fail to parse date string: Tue DEC 19 18:33:11 JST 2010 using format: %a %b %e %T %Y. Error code: U_PARSE_ERROR
2011-03-24T11:08:49: Warning: W-UNK-000-000: Failed to convert "Tue DEC 19 18:33:11 JST 2010" to DATETIME using format "%a %b %e %T %Y" - using current time
2011-03-24T11:08:49: Debug: D-UNK-000-000: string Tue DEC 19 18:33:11 JST 2010 to 1300936129
Cause
From 7.3.0, the old POSIX style date/time formats ( $tmp_time,"%a %b %e %T %Y") have been deprecated.
When using datetotime function in a probe rules file for OMNIbus 7.3.0 or later, then you need use the ICU formats that support all locales.
More details can be found in the OMNIbus 7.3.1 Release notes here:
http://publib.boulder.ibm.com/infocenter/tivihelp/v8r1/topic/com.ibm.netcool_OMNIbus.doc_7.3.1/omnibus/wip/relnotes/omn_relnotes731.html#relnotes__backward
Search for:
"Date and time formatting and parsing"
ICU formats as described here:
http://userguide.icu-project.org/formatparse/datetime
Resolving the problem
Using the above example, you should change the call for datetotime to resemble the following:
$tmp_time = "Tue DEC 19 18:33:11 JST 2010"
$date= datetotime ($tmp_time,"E MMM dd HH:mm:ss V yyyy")
log(debug,"string " + $tmp_time + " to " + $date)
That is because the formats mean the following:
E - locale specific abbreviation for the day of the week.
MMM - locale specific abbreviation for the name of the month
Note : "Tues" and "DEC" should be replaced by their Japanese equivalents.
Rate this page:
Copyright and trademark information
IBM, the IBM logo and ibm.com are trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml.