Salesforce Developer Event Monitoring Workbench


// Event Monitoring - Query Event Log Files in Workbench:

Before we get started, double-check that you have the correct permissions to 
query event log files. Event monitoring requires the “API Enabled” and 
“View Event Log File” permissions.

1. Log into Workbench: 
   b. For Environment, select Production. For API Version, select the highest 
      available number. Make sure that you check I agree to the terms of service.
   c. Click Login with Salesforce.

2. In the top menu, select "queries | SOQL Query".

3. Under Object, choose EventLogFile. Under Fields, select count(). Notice that 
   the editor populates with some query text.

4. Click Query.

The count() function returns how many EventLogFile records exist in your 
organization. If the response tells you “Query would return 0 records,” it means 
that you don’t have any stored events. Remember that it takes 24 hours for 
events to surface and the log files are only stored for 24 hours in DE 
organizations. If you don’t get any results back, you can retry tomorrow.

So what exactly does the EventLogFile object store? To find out, we can do 
what’s called an object describe:

1. In the top menu, select info | Standard & Custom Objects.

2. Select EventLogFile from the dropdown menu.

3. Expand the Attributes menu to view the object’s properties. EventLogFile is 
   queryable, which means that you can request information about the object from 
   the database. It’s also retrievable, so you can find an EventLogFile record 
   by its ID.

4. Expand the Fields menu. There are 15 fields here, but let’s pay particular 
   attention to two of them: EventType and LogFile.

   a. EventType: This field displays which of the more than 30 event types a 
      record represents. If you expand EventType | Picklist Values, you can see 
      the different types of events. In our case, we’re interested in records 
      with an EventType of Report Export.

   b. LogFile: This field is where the actual information you’re looking for is 
      stored. The contents of a log file depend on the EventType. For Report 
      Export, this field stores everything from the ID of the user that exported 
      the report to the browser and operating system that they used to do it.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License