@@ -1381,18 +1381,21 @@ initSystemInfo(J9JavaVM *vm)
1381
1381
{
1382
1382
J9RASSystemInfo * corePatternInfo = appendSystemInfoFromFile (vm , J9RAS_SYSTEMINFO_CORE_PATTERN , J9RAS_CORE_PATTERN_FILE );
1383
1383
if (NULL != corePatternInfo ) {
1384
+ static const char search [] = "/oneagent/agent/rdp" ;
1385
+ static const char replacement [] = "/oneagent/agent/conf/original_core_pattern" ;
1386
+ static const char original_core_pattern [] = "/var/lib/dynatrace/oneagent/agent/backup/original_core_pattern" ;
1387
+
1384
1388
/* A common core_pattern is Dynatrace; for example, |/opt/dynatrace/oneagent/agent/rdp
1385
- * This program sends the core to the originally configured
1386
- * core_pattern as stored in, for example,
1387
- * /opt/dynatrace/oneagent/agent/conf/original_core_pattern
1388
1389
*
1389
- * If we find this Dynatrace core_pattern, extract its installation
1390
- * directory and then read original_core_pattern relative to that.
1390
+ * Newer releases of Dynatrace capture the orginal core_pattern in a file at a fixed
1391
+ * location (original_core_pattern): if that file is found, it is assumed that the
1392
+ * installation of Dynatrace is recent and that file contains useful information.
1393
+ * Otherwise the location is derived from the current core_pattern, which based on
1394
+ * the example, would be /opt/dynatrace/oneagent/agent/conf/original_core_pattern.
1395
+ * If that file is found its contents are captured in the dump.
1391
1396
*/
1392
1397
const char * corePattern = (const char * )corePatternInfo -> data ;
1393
1398
if ('|' == corePattern [0 ]) {
1394
- static const char search [] = "/oneagent/agent/rdp" ;
1395
- static const char replacement [] = "/oneagent/agent/conf/original_core_pattern" ;
1396
1399
const char * dynatracePath = strstr (corePattern , search );
1397
1400
1398
1401
/* Check if core_pattern includes the Dynatrace agent. */
@@ -1401,8 +1404,15 @@ initSystemInfo(J9JavaVM *vm)
1401
1404
/* The length of the agent path prefix, minus the pipe character. */
1402
1405
size_t prefixLength = dynatracePath - corePattern - 1 ;
1403
1406
1404
- /* Ensure that the original_core_pattern path will fit in our buffer. */
1405
- if (prefixLength <= (sizeof (namebuf ) - sizeof (replacement ))) {
1407
+ if (NULL != appendSystemInfoFromFile (
1408
+ vm ,
1409
+ J9RAS_SYSTEMINFO_CORE_ORIGINAL_PATTERN ,
1410
+ original_core_pattern )
1411
+ ) {
1412
+ /* The information was found in the new, fixed location. */
1413
+ } else if (prefixLength <= (sizeof (namebuf ) - sizeof (replacement ))) {
1414
+ /* The original_core_pattern path fits in our buffer. */
1415
+
1406
1416
/* Copy the prefix starting after the pipe character. */
1407
1417
memcpy (namebuf , corePattern + 1 , prefixLength );
1408
1418
0 commit comments