Hidden reset flag for WebCenter Interaction Analytics

Recently I worked on a migration from some WebCenter Interaction servers to a virtual environment (you’re still using physical servers? How 2013…).

After the migration, there were some documents that weren’t showing up in WebCenter Analytics reports. As you probably know, Analytics events are stored in the ASFACT tables using objectIDs, and information about those events are captured in the ASDIM (dimension) tables to record information about those objectIDs (it’s done this way so that, even if you delete the object in the portal, you don’t lose the record of its access). But during some extensive testing, logging, and code decompiling, I discovered some interesting things that may be useful to you:

  • You can dramatically increase the logging that the Analytics sync job writes by changing the log settings to DEBUG in %PT_HOME%\ptanalytics\10.3.0\settings\config\sync-log4j.properties. This will give you details all the way down to the exact queries being run against the database.
  • The number of objects synched to the dimension tables, along with the results of the synch jobs, are stored in the ASSYS_JOBLOGS table – and that table is never cleared:
    wci-analytics-jobs
  • The Analytics Sync jobs that run nightly to update those dimension tables don’t actually look at all objects in the portal database; they look only look for objects that have been updated since the last time the job has run. This time comes from that ASSYS_JOBLOGS table.
  • There’s a hidden flag in the source code for the job called “-reset” that clears this job log table for that particular job entry, causing all objects for that job type to be re-scanned:
    wci-analytics-reset

Bottom line: if some of your Analytics reports don’t seem to contain all of the objects you’re expecting, it’s possible that events have been recorded but the dimensions simply don’t exist for them. If that’s the case, you can resolve this by adding -reset to the external operation in the WCI portal. Just remember to remove the flag after the job runs so that you’re not constantly clearing the logs every night and generating unnecessary load.

Here’s the relevant source code from com.plumtree.analytics.job.RunJobs if you’re interested:


private static void resetJob(IASJob job)
{
int jobType = job.getType();

Session session = null;
try
{
session = HibernateUtil.currentSession();

BatchJob.deleteJobByType(jobType, session);
}
catch (Exception e) {
log.error("Query or Hibernate error. Cannot clear job history from database");
HibernateUtil.closeSession();
}
}

public static boolean testConnect()
{
return true;
}

public static void main(String[] args)
{
SpringUtil.loadContext("applicationContext-jobs.xml");
RunJobs runJobs = (RunJobs)SpringUtil.getBean("runJobs");

String RESET = "-reset";

String appLoc = AnalyticsConfig.APPLICATION_PATH;
String logPath = "sync.log";
if (appLoc != null) {
logPath = appLoc + IASGlobals.LOGS_RELATIVE_PATH + logPath;
}

log(" Starting AnalyticsRunJobs ...");

HibernateUtil.refreshCustomDimensions();

AnalyticsDBProperties properties = new AnalyticsDBProperties();

ArrayList runJobObjects = new ArrayList();

long startTime = System.currentTimeMillis();
long lastTime = startTime;

boolean resetFlagged = false;
int argIndex = 0;

if ((args.length > 0) && (args[0].equals("-reset"))) {
resetFlagged = true;
++argIndex;
}

Map configuredJobs = runJobs.getJobs();
IASJob job;
boolean isEnabled;
RunJobObject obj;
if (args.length > argIndex)
{
for (int i = argIndex; i < args.length; ++i) {
String configCode = args[i];
job = (IASJob)configuredJobs.get(configCode);
if (job != null)
{
isEnabled = properties.getBooleanProperty(configCode, false, false).booleanValue();
if (isEnabled)
{
obj = new RunJobObject();
obj.job = job;
runJobObjects.add(obj);
}
} else {
log("Could not find job matching name: " + configCode);
}
}
}
else {
for (String jobCode : configuredJobs.keySet())
{
job = (IASJob)configuredJobs.get(jobCode);

isEnabled = properties.getBooleanProperty(jobCode, false, false).booleanValue();
if (isEnabled)
{
obj = new RunJobObject();
obj.job = job;
runJobObjects.add(obj);
}
else
{
log("Job '" + job.getName() + "' has been disabled. Skipping... ");
}

}

}

if (runJobObjects.size() > 0) {
HibernateUtil.closeSession();
} else {
log("There are no jobs to run. Make sure to pass in the appropriate job code.");
System.exit(1);
}

boolean successAll = true;

log.info("Running batch jobs");

for (Iterator it = runJobObjects.iterator(); it.hasNext(); )
{
runObject = (RunJobObject)it.next();

if (resetFlagged) {
resetJob(runObject.job);

}

Tags: , ,

Leave a Reply