Knowing who downloads what from the web

Is there a way for me to know when a user actually downloads an attachment from the web? It is relatively easy to track who visited which pages, but I cannot find something similar for downloads.


Who is Participating?
ZvonkoConnect With a Mentor Systems architectCommented:
Ok, here my agent collecting all downloads for all databases in /bulletin directory.
All collected records are stored in bulletin/access.nsf database. In that database you can build Views sorted by IP address, username, date, and so on. And in thise database you can calculate downloaded bytes to totals by any category.

Here the agent running on CreatedOrModified documents in domlog.nsf:

Sub Initialize
     Dim session As New NotesSession
     Dim db As NotesDatabase
     Dim protocolDb As New NotesDatabase( "", "bulletin/access.nsf" )
     Dim collection As NotesDocumentCollection
     Dim doc As NotesDocument
     Dim j As Long
     Set db = session.CurrentDatabase
     Set collection = db.UnprocessedDocuments
     For j = 1 To collection.Count
          Set doc = collection.GetNthDocument( j )
          If (Instr(1,doc.Request(0),"/bulletin")) Then
               If (Instr(1,doc.Request(0),"/$FILE/")) Or (Instr(1,doc.Request(0),"?OpenDocument")) Or (Instr(1,doc.Request(0),"?OpenForm"))  _
               Or (Instr(1,doc.Request(0),"?EditDocument"))  Or (Instr(1,doc.Request(0),"?CreateDocument")) Or ((Instr(1,doc.Request(0),"?OpenDatabase")) And Not ((doc.AuthenticatedUser(0) = "-"))) Then
                    Call doc.CopyToDatabase(protocolDb )          
               End If
          End If
          Call session.UpdateProcessedDoc( doc )
End Sub

Does this help?

Well, the link itself will generate an event in your http logs.  You can configure those logs (either w3c style text files or domlog.nsf) via the server configuration document.  In that case, an entry is created for each http activity.

A download will have a specific URL, and will contain $file as part of its url path.  For example:$file/filename.ext

there may be more, and there are several varations, but it will almost always have the $file as part of the url.

That should be easy enough to parse from the log entries.  If you make users log in, their log in name will be associated with the log entry.
ZvonkoSystems architectCommented:
Ok, and based on this /$FILE/ records in domlog.nsf you can make it even easy to observ how much bytes, how often and by home are fetched by copying this records into a separate log database customized for your application needs.

Do you like some code for this?

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

cyberzorkAuthor Commented:
Zvonko, yes, I would like to see some code.

cyberzorkAuthor Commented:
Thanks Zvonko. Haven't tried that yet, but I will.
ZvonkoSystems architectCommented:
Thanks for the points :-)

The agent is from my productive environment.
Only thing is that you have to adapt to your database names and logging requirements.

Good luck,

All Courses

From novice to tech pro — start learning today.