예제 #1
0
bool CLogThread::queueLog(IEspContext & context,const char* serviceName, const char* request, const char* response)
{
    IProperties* pProperties = context.queryRequestParameters();

    StringBuffer UserID, UserRealm, UserReference, peer;
    if(pProperties != NULL && pProperties->hasProp("userid_"))
        UserID.appendf("%s",pProperties->queryProp("userid_"));
    else
        context.getUserID(UserID);

    if(pProperties != NULL && pProperties->hasProp("fqdn_"))
        UserRealm.appendf("%s",pProperties->queryProp("fqdn_"));
    else
        context.getRealm(UserRealm);

    Owned<IPropertyTree> pLogTreeInfo = createPTreeFromXMLString(request, ipt_none, ptr_none);
    IArrayOf<IEspLogInfo> LogArray;
    addLogInfo(LogArray, *pLogTreeInfo.get());

    if(pProperties != NULL && pProperties->hasProp("referencecode_"))
    {
        //lets manually add the reference number....
        IClientLogInfo& LogInfoTransaction =  addLogInfoElement(LogArray);
        LogInfoTransaction.setName("referencenumber");
        LogInfoTransaction.setValue(pProperties->queryProp("referencecode_"));
    }

    LOG_INFO _LogStruct(serviceName,-1,false);
    return queueLog(UserID.str(), UserRealm.str() , context.getPeer(peer).str(),_LogStruct, LogArray );
}
예제 #2
0
bool CLogThread::queueLog(IEspContext & context,LOG_INFO& _LogStruct, IArrayOf<IEspLogInfo>& LogArray, IConstModelLogInformation* pModelLogInfo)
{
    if(!m_pLoggingService.get())
        return false;


    //Owned<IClientLOGServiceUpdateRequest> pRequest =  m_pLoggingService->createUpdateLogServiceRequest();
    IClientLOGServiceUpdateRequest* tptrRequest;
    if( m_bModelRequest )
    {
        IClientLOGServiceUpdateModelRequest* pUpdateModelRequest = m_pLoggingService->createUpdateModelLogServiceRequest();

        if(pModelLogInfo!=0)
        {
            pUpdateModelRequest->setModelLogInformation(*pModelLogInfo);
        }
        tptrRequest = dynamic_cast<IClientLOGServiceUpdateRequest*>(pUpdateModelRequest);
    } else {
        tptrRequest = m_pLoggingService->createUpdateLogServiceRequest();
    }
    Owned<IClientLOGServiceUpdateRequest> pRequest( tptrRequest );
    if (pRequest == 0)
        return false;



    StringBuffer UserID,realm,peer;
    pRequest->setUserName(context.getUserID(UserID).str());
    pRequest->setDomainName(context.getRealm(realm).str());
    pRequest->setRecordCount(_LogStruct.recordsReturned);
    pRequest->setServiceName(_LogStruct.serviceName);
    pRequest->setIP(context.getPeer(peer).str());
    bool bBlind = _LogStruct.Blind;
    bool bEncrypt = _LogStruct.Encrypt;

    ISecPropertyList* properties = context.querySecuritySettings();

    if( properties !=NULL)
    {
        if(bBlind==false)
        {
            if(properties->findProperty("blind")!=NULL)
                strncmp(properties->findProperty("blind")->getValue(),"1",1) == 0 ? bBlind=true : bBlind=false;
        }

        if(bEncrypt==false && properties->findProperty("encryptedlogging")!=NULL)
        {
            if(strncmp(properties->findProperty("encryptedlogging")->getValue(),"1",1) == 0)
                bEncrypt=true;
        }
    }
    if(bEncrypt==true)
    {
        //need to do encrpyted logging
        pRequest->setEncryptedLogging(true);
        pRequest->setRawLogInformation(_LogStruct.RequestStr.str());
    }

    pRequest->setBlindLogging(bBlind);
    pRequest->setLogInformation(LogArray);

    return queueLog(pRequest,_LogStruct);
}