Browse Source

HPCC-19505 View dali audit log in ECLWatch

Signed-off-by: wangkx <kevin.wang@lexisnexis.com>
wangkx 7 years ago
parent
commit
128617a23c

+ 1 - 0
esp/eclwatch/ws_XSLT/nls/en/hpcc.xml

@@ -155,6 +155,7 @@
 <st id='ViewDetails'>View Details</st>
 <st id='ViewingPage'>Viewing page</st>
 <st id='ViewLogFile'>View Log File</st>
+<st id='ViewAuditLogFile'>View Audit Log File</st>
 <st id='WarnIfAvailableDiskSpaceIsUnder'>Warn if available disk space is under</st>
 <st id='WarnIfAvailableMemoryIsUnder'>Warn if available memory is under</st>
 <st id='WarnIfCPUUsageIsOver'>Warn if CPU usage is over</st>

+ 1 - 0
esp/eclwatch/ws_XSLT/nls/zh/hpcc.xml

@@ -155,6 +155,7 @@
 <st id='ViewDetails'>显示详细内容</st>
 <st id='ViewingPage'>显示页号</st>
 <st id='ViewLogFile'>显示日志文件</st>
+<st id='ViewAuditLogFile'>显示审计日志文件</st>
 <st id='WarnIfAvailableDiskSpaceIsUnder'>警告如可用硬盘空间少于</st>
 <st id='WarnIfAvailableMemoryIsUnder'>警告如可用内存空间少于</st>
 <st id='WarnIfCPUUsageIsOver'>警告如CPU使用率大于</st>

+ 42 - 0
esp/eclwatch/ws_XSLT/services.xslt

@@ -542,6 +542,48 @@
                                                 </a>
                                             </xsl:if>
                                         </td>
+                                        <xsl:if test="$compType='DaliServerProcess'">
+                                          <td align="left" width="19">
+                                            <xsl:variable name="logDir">
+                                              <xsl:value-of  select="string(../../AuditLogDirectory)"/>
+                                            </xsl:variable>
+                                            <a style="padding-right:2">
+                                              <xsl:variable name="url">
+                                                <xsl:text>/WsTopology/TpGetComponentFile%3fNetAddress%3d</xsl:text>
+                                                <xsl:value-of select="Netaddress"/>
+                                                <xsl:text>%26FileType%3dlog%26CompType%3d</xsl:text>
+                                                <xsl:value-of select="$compType"/>
+                                                <xsl:text>%26OsType%3d</xsl:text>
+                                                <xsl:value-of select="OS"/>
+                                                <xsl:text>%26Directory%3d</xsl:text>
+                                              </xsl:variable>
+                                              <xsl:variable name="pageCaption">
+                                                <xsl:value-of select="concat('esp_iframe_title=', $caption, ' ', ../../Name, ' -- ', $hpccStrings/st[@id='LogFile'])"/>
+                                              </xsl:variable>
+                                              <xsl:attribute name="href">
+                                                <xsl:text>/esp/iframe?</xsl:text>
+                                                <xsl:value-of select="$pageCaption"/>
+                                                <xsl:text disable-output-escaping="yes">&amp;inner=</xsl:text>
+                                                <xsl:value-of select="$url"/>
+                                                <xsl:value-of select="$logDir"/>
+                                              </xsl:attribute>
+                                              <xsl:attribute name="onclick">
+                                                <xsl:text disable-output-escaping="yes">return popup('</xsl:text>
+                                                <xsl:value-of select="Netaddress"/>
+                                                <xsl:text disable-output-escaping="yes">', '</xsl:text>
+                                                <xsl:value-of select="translate($logDir, '\', '/')"/>
+                                                <xsl:text disable-output-escaping="yes">', '</xsl:text>
+                                                <xsl:value-of select="$url"/>
+                                                <xsl:text disable-output-escaping="yes">', "</xsl:text>
+                                                <xsl:value-of select="$pageCaption"/>
+                                                <xsl:text disable-output-escaping="yes">", </xsl:text>
+                                                <xsl:value-of select="OS"/>
+                                                <xsl:text>);</xsl:text>
+                                              </xsl:attribute>
+                                              <img border="0" src="&filePathEntity;/img/base.gif" alt="{$hpccStrings/st[@id='ViewAuditLogFile']}" title="{$hpccStrings/st[@id='ViewAuditLogFile']}" width="19" height="16"/>
+                                            </a>
+                                          </td>
+                                        </xsl:if>
                                         <td width="14">
                                             <xsl:choose>
                                                 <xsl:when test="$compType!='' and ($compType!='EclAgentProcess' or OS=0)">

+ 2 - 1
esp/scm/ws_topology.ecm

@@ -82,6 +82,7 @@ ESPStruct TpDali
     string Type;
     string Path;
     string LogDirectory;
+    [min_ver("1.27")] string AuditLogDirectory;
     ESParray<ESPstruct TpMachine> TpMachines;
 
 };
@@ -611,7 +612,7 @@ ESPresponse [nil_remove, exceptions_inline] TpDropZoneQueryResponse
     ESParray<ESPstruct TpDropZone>    TpDropZones;
 };
 
-ESPservice [auth_feature("DEFERRED"), noforms, version("1.26"), exceptions_inline("./smc_xslt/exceptions.xslt")] WsTopology
+ESPservice [auth_feature("DEFERRED"), noforms, version("1.27"), exceptions_inline("./smc_xslt/exceptions.xslt")] WsTopology
 {
     ESPmethod [cache_seconds(180), cache_global(1), resp_xsl_default("/esp/xslt/targetclusters.xslt")] TpTargetClusterQuery(TpTargetClusterQueryRequest, TpTargetClusterQueryResponse);
     ESPmethod [cache_seconds(180), cache_global(1), resp_xsl_default("/esp/xslt/topology.xslt")] TpClusterQuery(TpClusterQueryRequest, TpClusterQueryResponse);

+ 1 - 1
esp/services/ws_topology/ws_topologyService.cpp

@@ -1259,7 +1259,7 @@ bool CWsTopologyEx::onTpServiceQuery(IEspContext &context, IEspTpServiceQueryReq
         {
             IEspTpServices& ServiceList = resp.updateServiceList();
 
-            m_TpWrapper.getTpDaliServers( ServiceList.getTpDalis() );
+            m_TpWrapper.getTpDaliServers( version, ServiceList.getTpDalis() );
             m_TpWrapper.getTpEclServers( ServiceList.getTpEclServers() );
             m_TpWrapper.getTpEclCCServers( ServiceList.getTpEclCCServers() );
             m_TpWrapper.getTpEclAgents( ServiceList.getTpEclAgents() );

+ 13 - 5
esp/smc/SMCLib/TpWrapper.cpp

@@ -165,7 +165,7 @@ void CTpWrapper::fetchInstances(const char* ServiceType, IPropertyTree& service,
     }
 }
 
-void CTpWrapper::getTpDaliServers(IArrayOf<IConstTpDali>& list)
+void CTpWrapper::getTpDaliServers(double clientVersion, IArrayOf<IConstTpDali>& list)
 {
     Owned<IPropertyTree> root = getEnvironment("Software");
     if (!root)
@@ -185,17 +185,25 @@ void CTpWrapper::getTpDaliServers(IArrayOf<IConstTpDali>& list)
         pService->setBuild(serviceTree.queryProp("@build"));
         pService->setType(eqDali);
 
-        StringBuffer tmpDir;
+        StringBuffer tmpDir, tmpAuditDir;
         if (getConfigurationDirectory(root->queryPropTree("Directories"), "log", "dali", name, tmpDir))
         {
             const char* pStr = tmpDir.str();
             if (pStr)
             {
                 if (strchr(pStr, '/'))
-                    tmpDir.append("/server");
+                    tmpDir.append("/");
                 else
-                    tmpDir.append("\\server");
-                pService->setLogDirectory( tmpDir.str() );
+                    tmpDir.append("\\");
+                tmpAuditDir.set(tmpDir.str());
+
+                tmpDir.append("server");
+                pService->setLogDirectory(tmpDir.str());
+                if (clientVersion >= 1.27)
+                {
+                    tmpAuditDir.append("audit");
+                    pService->setAuditLogDirectory(tmpAuditDir.str());
+                }
             }
         }
         else

+ 1 - 1
esp/smc/SMCLib/TpWrapper.hpp

@@ -167,7 +167,7 @@ public:
     void setTpMachine(IConstMachineInfo* machine, IEspTpMachine& tpMachine);
     IEspTpMachine* createTpMachineEx(const char* name, const char* type, IConstMachineInfo* machineInfo);
 
-    void getTpDaliServers(IArrayOf<IConstTpDali>& list);
+    void getTpDaliServers(double clientVersion, IArrayOf<IConstTpDali>& list);
     void getTpEclServers(IArrayOf<IConstTpEclServer>& ServiceList, const char* name = NULL);
     void getTpEclCCServers(IArrayOf<IConstTpEclServer>& ServiceList, const char* name = NULL);
     void getTpEclCCServers(IPropertyTree* environmentSoftware, IArrayOf<IConstTpEclServer>& ServiceList, const char* name = NULL);