Project Description
The Activity Tracking Log is a pluggable component intended to provide user and system activity tracking functions for ASP.Net/MVC applications. Represents a set of HTTP handlers and modules that expose activity analytic reports and client side API. Easy to configure and use.
Features
Current Features
- Easy configurable
- Multiple storage providers (InMemory and MSSQL supported by default)
- Server and client side activity tracking
- Collects time, activity details, user name (ASP.Net identity), remote IP, user agent, page URL/query params
- A dedicated module logs server side events (useful for debugging)
- AJAX enabled secured logging proxy on the client side
- Direct access to logging classes from server side
- ASP.Net MVC action filter
- Multitenancy
- Can collect multiple applications into same storage (InMemory storage doesn't support this)
- Activity reports accessed from current application automatically filter out activity records collected from other applications
- Reports
- Out of the box basic reports (no need to create new forms in your application)
- Paging (configurable page size), columns selection, data sorting
- Activity List - flat list of collected activities
- Activity Grouped List - shows records count by grouping criteria (criteria is configurable)
- Chart (see planned features)
- AJAX enabled report controls (a pre-built dataview to be embedded into your custom report)
- Exposes flat and grouped data via JSON (data provider for your custom report)
- Server side report control renderer (Builds reporting control layout/data directly in your ASP.Net page markup)
Planned FeaturesNote: planned version could be changed without notice.
- Report data filtering (v0.1.2)
- Tabular reports filtering (Text input field in each column header. Filtering rule 'StartsWith')
- Extended filter criteria (Separated filter form. Filtering rules: Range, StartsWith, Equal, NotEqual, etc.)
- Chart View as part of analytic reports (v0.1.3)
- Export collected data in a CSV file (Flat or grouped) (v0.1.4)
- MVC sample project
- Unit Tests
- Hosted demo for public access
Configuration and Usage
Easy to configure and use - add ActivityTrackingLog.dll as a reference to your project, copy default configuraion from sample project, call Log.LogActivity(...) from your page and you are done!
Reference the ActivityTrackingLog.dll assembly in your project
Copy the default ActivityTrackingLog configuration from here or from the sample project
<configSections>
<!-- activity tracking log section group -->
<sectionGroup name="activityTrackingLog">
<section name="log" requirePermission="false"
type="ActivityTrackingLog.Configuration.ConfigSections.LogConfigSection, ActivityTrackingLog" />
<section name="storage" requirePermission="false"
type="ActivityTrackingLog.Configuration.ConfigSections.StorageConfigSection, ActivityTrackingLog" />
<section name="clientSideAccess" requirePermission="false"
type="ActivityTrackingLog.Configuration.ConfigSections.ClientAccessConfigSection, ActivityTrackingLog" />
<section name="ui" requirePermission="false"
type="ActivityTrackingLog.Configuration.ConfigSections.UiConfigSection, ActivityTrackingLog" />
<section name="api" requirePermission="false"
type="ActivityTrackingLog.Configuration.ConfigSections.ApiConfigSection, ActivityTrackingLog" />
</sectionGroup>
</configSections>
<!-- activity tracking log settings -->
<activityTrackingLog>
<log enabled="true" applicationKey="YourApplicationName" logSystemEvents="true" logSessionEvents="true"
logRequestEvents="true" logAuthEvents="true" logUserAgent="true" />
<storage enabled="true" type="ActivityTrackingLog.Storage.Implementations.InMemoryRepository, ActivityTrackingLog"
oldestDate="10/10/2011 00:00:00" recordsLimit="10000" connectionString="connection to your database" />
<clientSideAccess enabled="true" handlerUrl="/ActivityAnalytics/ClientActivitiesHandler.axd"/>
<ui enabled="true" localOnly="false" />
<api enabled="true" localOnly="false" />
</activityTrackingLog>
<!-- Handlers configuration -->
<location path="ActivityAnalytics">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
<!-- this section is used for developmnet server, IIS < 7.0 or IIS >= 7.0 in classic mode -->
<httpHandlers>
<add verb="POST,GET,HEAD" path="ActivityAnalyticsUI.axd" type="ActivityTrackingLog.Web.Handlers.AnalyticsUI, ActivityTrackingLog" />
<add verb="POST,GET,HEAD" path="ActivityAnalyticsApi.axd" type="ActivityTrackingLog.Web.Handlers.AnalyticsApi, ActivityTrackingLog" />
<add verb="GET" path="ClientSideLogClient.axd" type="ActivityTrackingLog.Web.Handlers.ClientSideLogClient, ActivityTrackingLog" />
<add verb="POST" path="ClientActivitiesHandler.axd" type="ActivityTrackingLog.Web.Handlers.ClientActivitiesHandler, ActivityTrackingLog" />
</httpHandlers>
</system.web>
<system.webServer>
<!-- this section is used for IIS >= 7.0 in integrated mode -->
<handlers>
<add name="ActivityAnalyticsUI" verb="POST,GET,HEAD" path="ActivityAnalyticsUI.axd"
type="ActivityTrackingLog.Web.Handlers.AnalyticsUI, ActivityTrackingLog" preCondition="integratedMode" />
<add name="ActivityAnalyticsApi" verb="POST,GET,HEAD" path="ActivityAnalyticsApi.axd"
type="ActivityTrackingLog.Web.Handlers.AnalyticsApi, ActivityTrackingLog" preCondition="integratedMode" />
<add name="ClientSideLogClient" verb="GET" path="ClientSideLogClient.axd"
type="ActivityTrackingLog.Web.Handlers.ClientSideLogClient, ActivityTrackingLog" preCondition="integratedMode" />
<add name="ClientActivitiesHandler" verb="POST" path="ClientActivitiesHandler.axd"
type="ActivityTrackingLog.Web.Handlers.ClientActivitiesHandler, ActivityTrackingLog" preCondition="integratedMode" />
</handlers>
</system.webServer>
</location>
<!-- Modules Configuration -->
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true">
<add name="SystemEventsLogging" type="ActivityTrackingLog.Web.SystemEventsLoggingModule, ActivityTrackingLog" />
</modules>
</system.webServer>
Call the logging function from your page code
- ASP.Net Web Forms Application
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
// log server side activity
var activityItem = Log.LogActivity("WebPages", "HomePageAccessed");
if (null != activityItem)
{
lblLoggedServerMessage.Text =
string.Format("This page triggered an SERVER side activity [{0}] at {1}",
activity.ToString(),
activityItem.TimeUtc.ToString("MM/dd/yyyy HH:MM:ss.fff"));
}
}
}
// 1. This will log all accessed actions with Category = "ProductController" , Activity = "ActionName"
[LogActivity()]
public class ProductController : Controller
{
...
// 2. This will log current action with Category = "ProductController" , Activity = "Index"
[LogActivity()]
public ActionResult Index()
{
// 3. Static method call
Log.LogActivity("ProductController", "IndexAccessed");
return View();
}
...
}
And you are done!
Examples below show out-of-the box analysis UI.
Collected Activities
Sample URL (You need to run the sample project to access it):
http://localhost:54055/ActivityAnalytics/ActivityAnalyticsUI.axd?cols=sequence,timeutc,activitytype,category,activity,userkey,pageurl
Grouped Activities
Sample URL (You need to run the sample project to access it):
http://localhost:54055/ActivityAnalytics/ActivityAnalyticsUI.axd?entity=ActivityItem&view=page&report=groupedlist&cols=ActivityType,Category,Activity,PageUrl,Count
Chart
Coming soon...