12 January 2016

Logging Salesforce User Activity with Heroku's Logplex

If you can't already tell, I'm huge advocate of logging user activity. There's something incredibly powerful about understanding what people did in the past. I guess it harkens back to my days as a high school history teacher where I would tell everyone on the first day of class that students who fail my class are doomed to repeat it.

In my quest for understanding how salesforce customers want to log activity and measure it, there are some consistent themes I've heard:
1. the use case always drives the granularity of the data we need to capture
2. while real-time isn't always necessary, it's almost always desired
3. I really want one place to go to for log data
4. if I have access to the raw log data, I can always slice-and-dice it the way I want in my reporting app of choice

One interesting solution that I've been playing with is capturing events in Salesforce orgs and sending them over to Heroku. If you haven't heard of Heroku before, you should check it out. It's a platform for developers to effectively deploy and manage their applications. One of the great advantages of Heroku is it's great add-on platform called Elements. Whether it's cache, video processing, data storage, or monitoring, it's easy to plug Heroku apps into a great ecosystem of app providers.

Logging Salesforce user activity is pretty simple:
1. I created a polling app that runs on Heroku. In my case, I created a python script that polls Salesforce every minute to retrieve Setup Audit Trail events. But it could just as easily captured Login History, Data Leakage, Apex Limit Events, or really any object accessible via the Salesforce API.
2. The python script writes Salesforce user events to the Heroku logging system called LogPlex
3. LogPlex is integrated with a series of add-ons including Logentries, Sumologic, and PaperTrail. It can also be integrated into other back end systems like a SIEM tool or notification apps like PagerDuty

The advantages of this solution include:
  • it's near real-time (or as real time as the frequency of the polling app you create)
  • it has the ability to further integrate events from other Heroku apps that you've built
  • Heroku has a great add-on ecosystem that makes it easy to turn these events into insights

The disadvantages of this solution include:
  • Heroku's LogPlex only persists the last 1500 events and can be lossy since it was really intended to be used for logging performance trends rather than security events like escalation of privileges.
  • the polling app will count against API limits. If it polls every minute, it will cost you 1440 API calls per day.
To try this solution, check out the sample Setup Audit Trail python script on my Github Repo.


  1. I really appreciate your blog. your blog is really cool and great.your blog is awesome and great.Your blog is cool and great.thanks for sharing the nice and cool post. keep it up. With site piknu you can see top user on instagram

  2. Hi Nice blog
    Fire and Safety is a important need in daily life. So learning about Safety is more important. Study Fire and Safety Course in Chennai. Spplimited is a professional Training Institute on providing qualified Safety training.
    For more information:
    Safety Course in Chennai
    Fire and Safety courses in Chennai
    Industrial Safety courses in Chennai

  3. Top prospect Jon Gray gets his second invite to camp. The big right hander mission this spring is to hone his talents and show more consistency. Can he make the 25 man roster out of camp? It possible, but I wouldn bet on it. I love and need a very clean work environment, a great notebook/organizer and lots of pens and pencils. [I] have a giant bulletin board with my tear sheets, some inspiring words and more photos of my family. A few of our girls' "drawings" and photo booth pics and a picture of a renovated airstream which is something I aspire to do and have.. (tags: Coach Outlet Store Online , Michael Kors Bags Sale, Coach Outlet Store, MK Outlet)

    Perhaps the only serious drawback is that WuliWeb provides its users only with LINKS to content stored on publishers' web sites. It is a directory service not a full text database. This creates dependence. Dr. J. Wesley Boyd, an attending psychiatrist at Cambridge Health Alliance, recommends objective, calm responses such as "Is there any way you can reframe that question?" or "What you've said is offensive to me." Dr. (tags: Cheap Real Yeezys, Discount Jordan Shoes Wholesale, Cheap Yeezys)

    Buying lift tickets on the slopes to dinning, accommodations, there are different expenses that you can experience. Everyone has been planning and anticipating for months and the date is fast approaching. The only problem is, you the only one who doesn know how to ride a Vail snowmobile rental (tags: Jordan Shoes For Sale Cheap, 2020 Jordan Release Dates, Ray Ban Sunglasses Outlet).

  4. You will agree with me that women are generally synonymous to fashion. And one of the fashion Coach Handbags Clearance that women adore so much when they want to look fashionable and thus look beautiful, is fine looking attractive and quality New Air Jordan Shoes. Thus, in as much as women love putting on quality fine looking Cheap Air Force Ones, research has confirmed that women just don't throw money around like their opposite counterpart, so quality fine looking MK Outlet they prefer, but they also prefer buying them cheap. An increasing number of people these days are finicky about the kind of Air Jordan Sale they wear. While almost everyone wants to wear the latest Michael Kors Factory Outlet and trendiest Cheap Yeezys not many are prepared to shell out exorbitant amounts of money for these. Therefore, if you want to know insider secrets to buy cheap Coach Factory Outlet Online read on to know more. (Article Source From Coach Outlet Clearance Sale)