How to trigger a KPSA log file rollover.

How to trigger a KPSA log file rollover.

book

Article ID: KB0084656

calendar_today

Updated On:

Products Versions
TIBCO KPSA - Mobile -
Not Applicable -

Description

Resolution:
Description:
============
In some cases the maximum file size or maximum file age are not enough to configure the KPSA log files rollover as expected. We may want to trigger the rollover every day, for example. This article explains how to trigger the filewriter rollover from a script so that it can be based on crontab or other external events.

Environment:
===========
TIBCO® KPSA - Mobile or TIBCO® KPSA - Broadband

Resolution:
==========
The FileWriter exposes a "rollover" operation in the API. It is possible to call it through a php script (or any kind of soc/act custom code), such the one included here as an exemple.

To use it, just type in the kpsa node folder: swphp -p &ltnode> -g fwname=CART_AdminTopic fwRollOver.php, and rollover on corresponding filewriter will be called.

Attachments:
===========
fwRollOver.php

<?
$xconn = os_connect();
$php_errormsg="";

$attrs = array();
$attrs["cfg_name"] = "$fwname";

$fw = os_extent($xconn, "fwxservices::FileWriter", $attrs);
if ($php_errormsg != "")
{
    print "os_extent failed: $php_errormsg\n";
    exit(1);
}  
if (count($fw) == 0)
{
    print "Did not found the filewriter for cfg_name=$fwname\n";
    exit(1);
}
print "Found fwriter $fw[0]\n";

os_invoke($xconn, $fw[0], "rollover");
if ($php_errormsg != "")
{
    print "os_invoke failed: $php_errormsg\n";
    exit(1);
}  
print "Successfully called rollover\n";

os_disconnect($xconn);
?>

References:
==========
rollover configuration details can be found in documentation server under fwxservices.

Issue/Introduction

How to trigger a KPSA log file rollover.