• dinesh S 31
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 0
    Replies
Could you any please let me know how to get the logfile from eventlog and sent it to execute method

global class batchEventLog implements Database.Batchable<sObject> {


    list<string> headersList{get;set;}
    Set<String> csvHeader = new Set<String>();
    String combinedDataAsHex = '';
    Blob combinedDataAsBlob;
    String csvFileData ='';
    String userEmail ='';
    String newSetStr = '' ; 
    List<String> newSetStrList = new List<String>();
    String noOfDays = '';
    Set<String> strEventTypes = new Set<String>();
   // HttpRequest req = new HttpRequest();
    public list<String> eventTypelist = new list<String>();
    
    
    
    
   
    global Database.QueryLocator start(Database.BatchableContext BC) {
    
    
    System.debug('I am inside the start method');
    
    List<String> eventTypesArr = new List<String>();
        List<Event_Log_File_Configuration__mdt> eventconf = new List<Event_Log_File_Configuration__mdt>([SELECT Event_Types__c, Duration_in_days__c, User_Email__c FROM Event_Log_File_Configuration__mdt where DeveloperName = 'Event_Log' limit 1]);
        userEmail = eventconf[0].User_Email__c;
        noOfDays =  eventconf[0].Duration_in_days__c;
        String eventTypes = eventconf[0].Event_Types__c;
        if(eventTypes.contains(',')){
            eventTypesArr = eventTypes.split(',');
        }
        else{
            eventTypesArr.add(eventTypes);
        }
        for(String evStr : eventTypesArr){
            strEventTypes.add(evStr);
        }
    
     for(String evStr : eventTypelist){
            strEventTypes.add(evStr);
        } 

       System.debug('::::Event Type Values::::' + strEventTypes);
        for(String str : strEventTypes){
            newSetStr += '\'' + str + '\',';
        
       newSetStr = newSetStr.lastIndexOf(',') > 0 ? '(' + newSetStr.substring(0,newSetStr.lastIndexOf(',')) + ')' : newSetStr ;
        }
       System.debug('***************The value of newSetStr is '+newSetStr); 
       newSetStrList.add(newSetStr);
        system.debug('**********************newSetStrList'+newSetStrList);
  
      String query = 'Select Id,LogFile,EventType from EventLogFile';
    
      //  Blob s = 'Select Id,LogFile,EventType from EventLogFile';
        
  //      string query = b.tostring();
          //query = EncodingUtil.base64Decode(EncodingUtil.base64Encode(b)).toString();

        return Database.getQueryLocator(query);
    }
   
    global void execute(Database.BatchableContext BC, List<EventLogFile> scope) {
    
          System.debug('Iam inside the execute method');
         for(EventLogFile a : scope)
         {
             System.debug('The value of event log  file'+a.EventType);
             System.debug('The value of log file is '+a.LogFile);
                         
         }
        
    }   
    
    global void finish(Database.BatchableContext BC) {
    }
}
we are facing some challenges regarding Encryption

we are fetching some list of users in " userlist ".

set EmailSet= new set();

for(user u : userlist){
EmailSet.add(u.Email);

}

for(contact con : [selct id,name,Email from contact where Email IN :EmailSet]){

////some code/////;

}

in above code Email field in contact object is Probabilistic/Deterministic  encrypted field.
now please guide me how to replace this SOQL "[selct id,name,Email from contact where Email IN :EmailSet]" with SOSL.