In this topic:

Definition

1 - Program Events

2 - Web Site Events

3 - Snapshots

4 - Email Events

104 - Email Attachments

5 - Keystroke Events

7 - Chat/IM Events

8 - File Transfer (P2P) Events

10 - Keyword Alerts

11 - Network Events (Port)

12 - Document Tracking Events

13 - User Activity

14 - Online Searches

A Simple API to the Database

Developer Tools

It is possible to retrieve data directly from the database for use in other applications or processes. This section provides information on those tools.

The Spector 360 Database provides a stored procedure that allows you to access data directly from the database to use for other purposes. Only the System Administrator login can access this stored procedure. Remember to take into account any permissions (i.e., "read" access to Attachment and Snapshot files) necessary for accessing the data.

Definition

The ReturnRawDataSet stored procedure retrieves a list of records (with all data fields) for one event type within a time range. Seven possible parameters allow you to specify the data you want.

For example, the procedure could retrieve all Email events from January 1-10 for user Bill Smith (on the CHICAGO domain) recorded on any computer. The procedure would be called as follows:

 

EXEC SPCTR_ADMIN.dbo.usp_Utility_ReturnRawDataSet @int_EventType_ID = 4

   ,@int_TransactionID = 0

   ,@dte_StartDate = '2008/01/01 00:00:00'

   ,@dte_EndDate = '2008/01/10 23:59:59'

   ,@int_MaxRowCountPerRequest = 0

   ,@str_FullLoginName = 'CHICAGO\bsmith'

   ,@str_ComputerName = ' '

NOTE: A call to the stored procedure requires a value for EventType_ID, StartDate and EndDate. Other parameters are optional. If you use the parameter names in the call, the order and inclusion of optional parameters will not be required. If you do NOT use the parameter name (supply just the value) all parameter values must appear in the order shown above.

ID

EVENT TYPE

1

Program Events

2

Web Site Events

3

Snapshots

4

Email Events

104

Email Attachments

5

Keystroke Events

7

Chat/IM Events

8

File Transfer (P2P) Events

10

Keyword Alerts

11

Network Events (Port)

12

Document Tracking Events

13

User Activity

14

Online Searches

Identifies a transaction (record) to use as a starting point. Each record inserted in the database is associated with a Transaction ID. A Transaction ID value of 0 (zero) begins a count of Transaction IDs retrieved. Use the Transaction ID to control the row pointer for successive calls.  For example, if 5889 records are retrieved in the first call, to get the next segment of data, the subsequent call would specify: ,@int_TransactionID = 5889

If you use the MaxRowCount argument, the number of rows (records) you specify will be retrieved as a maximum. If you do NOT use the MaxRowCount argument, a maximum of 50,000 records will be retrieved. To retrieve the next set of records beyond the maximum, you need to use: ,@int_TransactionID = 50000  

Transaction IDs vs. Dates
Transaction IDs are retrieved sequentially in the same order in which the records were inserted in the database. However, you cannot assume that Transaction IDs will also be ordered by date. Example: A sales person disconnects from the network for 5 days, returns to the office, and all recordings are uploaded at that time. Transaction IDs from the salesman's data are ordered as they were inserted in the database, while the recording date/time of each transaction accurately reflects the time of the recording:

Transaction 1 - Recording date was 2008/01/20  employee

Transaction 2 - Recording date was 2008/01/21  employee

Transaction 3 - Recording date was 2008/01/15  salesman

Transaction 4 - Recording date was 2008/01/16  salesman

Transaction 5 - Recording date was 2008/01/22 employee

The required StartDate and EndDate parameters specify the beginning and end of the date and time range for the data you want to retrieve. Data records are stored by date and time and usually are retrieved sequentially from earliest to latest within the time range (see the note above).  Only records within the date range will be retrieved.

Be sure to use the format: yyyy/mm/dd  hh:mm:ss
No milliseconds are used.

For example, the following call retrieves all Program records for all users from midnight, January 1, to a second before midnight, January 5 (up to the default limit of 50,000 records).

EXEC SPCTR_ADMIN.dbo.usp_Utility_ReturnRawDataSet @int_EventType_ID = 1
,@dte_StartDate = '2008/01/01 00:00:00'
,@dte_EndDate = '2008/01/05 23:59:59'

Use the Maximum Row Count parameter to specify the maximum number of rows to return for each call to the procedure. The number of rows actually returned may be fewer, but will not exceed this maximum. This parameter allows you to expand the maximum if you need to retrieve more than 50k records in a single call, or reduce the maximum if your processing resources are limited. If you omit this parameter or use the default 0 value, the maximum rows retrieved per call will be 50,000.   

Requesting a large number of data records will consume disk and memory resources on your database machine. Be especially careful when requesting content-heavy events, such as Email or Keystrokes.  If the database machine is being used for other processes, we recommend using the default 50K row limit or setting an even smaller maximum row count.

 

Use the Full Login Name string parameter (maximum 128 characters) to retrieve data recorded for an individual user. You can omit this parameter (or pass an empty string) to retrieve event records for ALL users.  Use the complete Domain\Username specification, as listed in the Dashboard Management Users list, or as returned by this procedure without this parameter.  

Use the Computer Name string parameter (maximum 128 characters) to retrieve data recorded on a single computer. You can omit this parameter (or pass an empty string) to retrieve event records for ALL computers.  Use the complete computer name specification, as listed in the Dashboard Management Computers list, or as returned by this procedure when this parameter is not used.  

1 - Program Events

ID =

 

Fields Returned (in order)

Data Type (max chars)

1

 

Program -  Program Eyents

 

 

1

StartDateTime     

datetime        

 

2

TransID

int    

 

3

ComputerDomainName

varchar(255)    

 

4

ComputerName

varchar(255)

 

5

FullLoginName

varchar(512)

 

6

ProgramName

varchar(128)

 

7

TotalTime

int     

 

8

FocusTime

int

 

9

ActiveTime

int

 

10

WindowCaption

varchar(128)

 

2 - Web Site (URL) Events

ID =

 

Fields Returned (in order)

Data Type (max chars)

2  

 

URL  Web Sites Visited

 

 

1

StartDateTime

datetime    

 

2

TransID

int    

 

3

ComputerDomainName

varchar(255)    

 

4

ComputerName

varchar(255)

 

5

FullLoginName

varchar(512)

 

6

ProgramName

varchar(128)

 

7

TotalTime

int

 

8

FocusTime

int

 

9

ActiveTime              

int

 

10

URI

varchar(50)

 

11

HostName

varchar(256)

 

12

DomainName

varchar(256)

 

13

WindowCaption

varchar(128)

 

14

URL

varchar(3072)

 

3 - Screen Snapshots

ID =

 

Fields Returned (in order)

Data Type (max chars)

3

 

Snapshot - Screen Snapshots

 

 

1

StartDateTime

datetime   

 

2

TransID

int    

 

3

ComputerDomainName

varchar(255)   

 

4

ComputerName

varchar(255)

 

5

FullLoginName  

varchar(512)

 

6

EndDateTime

datetime

 

7

UNCPath

varchar(512)

 

8

FileName

varchar(128)

 

9

SnapshotCount

int

 

10

EncryptKeyType

int

 

11

EncryptKeyGUID

varchar(40)

Notes about Snapshot Events:

4 - Email Events

ID =

 

Fields Returned (in order)

Data Type (max chars)

4

 

Email  

 

 

1

RecordedDateTime

datetime    

 

2

TransID

int   

 

3

ComputerDomainName

varchar(255)

 

4

ComputerName

varchar(255)

 

5

FullLoginName  

varchar(512)

 

6

ProgramName

varchar(128)

 

7

AttachCount

int

 

8

IncomingFlag

int

 

9

EMailType

varchar(12)

 

10

EMailBodyType

varchar(64)

 

11

FromName

varchar(128)

 

12

FromAddress

varchar(128)

 

13

ToNameAddress

blob

 

14

Subject

varchar(512)

 

15

CCNameAddress

blob

 

16

BCCNameAddress

blob

 

17

EncryptedFlag

int

 

18

TooBigFlag

int

 

19

UnsentFlag

int

 

20

BodyErrorFlag

int

 

21

AttachErrFlag

int

 

22

AttachOffFlag

int

 

23

WebMailHost

varchar(256)

 

24

BodyDisplay

blob

 

25

BodyText                

blob

For email attachment information, make a call to Event Type 104, as described below. The first call below to Event Type 4 returns the first 50,000 (maximum) email events for the given date range. The second call returns all email attachments matching the email events returned in the first call.

SPCTR_ADMIN.dbo.usp_Utility_ReturnRawDataSet @int_EventType_ID = 4

   ,@int_TransactionID = 0

   ,@dte_StartDate = '2006/01/01 00:00:00'

   ,@dte_EndDate = '2006/01/10 23:59:59'

   

 

SPCTR_ADMIN.dbo.usp_Utility_ReturnRawDataSet @int_EventType_ID = 104

   ,@int_TransactionID = 0

   ,@dte_StartDate = '2006/01/01 00:00:00'

   ,@dte_EndDate = '2006/01/10 23:59:59'

   

 

104 - Email Attachments

For email events returned (event type 4) that have file attachments, a call made to Event Type 104 returns the following fields.

ID =

 

Fields Returned (in order)

Data Type (max chars)

104

 

Email  Attachment

 

 

1

TransID

int   

 

2

AttachedFileName

varchar(100)

 

3

AttachmentName

varchar(256)

 

4

FileSize  

int

 

5

UNCPath

varchar(512)

 

6

EncryptKeyType

int

 

7

EncryptKeyGUID

varchar(40)

Notes about Email attachments:

5 - Keystroke Event

ID =

 

Fields Returned (in order)

Data Type (max chars)

5

 

Keystroke - Keystrokes Typed

 

 

1

StartDateTime

datetime    

 

2

TransID

int

 

3

ComputerDomainName

varchar(255)

 

4

ComputerName

varchar(255)

 

5

FullLoginName

varchar(512)

 

6

ProgramName

varchar(128)

 

7

FormattedKeyCount

int

 

8

WindowCaption

varchar(128)

 

9

KeyboardLocale

varchar(20)

 

10

CharacterSet

int

 

11

KeystrokeCombined

blob

Notes about Keystrokes:

7 - Chat/IM Event

ID =

 

Fields Returned (in order)

Data Type (max chars)

7

 

Chat - Chat/IM Activity

 

 

1

RecordedDateTime

datetime    

 

2

TransID

int

 

3

ComputerDomainName

varchar(255)

 

4

ComputerName

varchar(255)

 

5

FullLoginName

varchar(512)

 

6

ProgramName

varchar(128)

 

7

ChatDataFormat

varchar(20)

 

8

ChatType

varchar(20)

 

9

ProtocolType

varchar(20)

 

10

ChatUserName

varchar(128)

 

11

ChatRemoteUsers

varchar(1024)

 

12

WindowCaption

varchar(128)

 

13

ChatData

blob    

 

8 - Files Transferred (P2P)

ID =

 

Fields Returned (in order)

Data Type (max chars)

8

 

P2P - Files Transferred

 

 

1

RecordedDateTime        

datetime    

 

2

TransID

int

 

3

ComputerDomainName

varchar(255)

 

4

ComputerName

varchar(255)

 

5

FullLoginName

varchar(512)

 

6

ProgramName

varchar(128)

 

7

P2PAction

varchar(20)

 

8

P2PProtocolType

varchar(20)

 

9

IPAddress

varchar(50)

 

10

FullDomain

varchar(256)

 

11

FileName

varchar(256)

 

10 - Keyword Alert

ID =

 

Fields Returned (in order)

Data Type (max chars)

10

 

Keyword - Keyword Alert

 

 

1

RecordedDateTime        

datetime    

 

2

TransID

int

 

3

ComputerDomainName

varchar(255)

 

4

ComputerName

varchar(255)

 

5

FullLoginName

varchar(512)

 

6

ProgramName

varchar(128)

 

7

Keyword

varchar(50)

 

8

KeywordSource

varchar(20)

 

9

IPAddress

varchar(50)

 

11 - Network Event (Port)

ID =

 

Fields Returned (in order)

Data Type (max chars)

11

 

Port - Network Activity

 

 

1

StartDateTime       

datetime    

 

2

TransID

int

 

3

ComputerDomainName

varchar(255)

 

4

ComputerName

varchar(255)

 

5

FullLoginName

varchar(512)

 

6

ProgramName

varchar(128)

 

7

IPAddress

varchar(50)

 

8

Port

 int

 

9

HostName

varchar(256)

 

10

DomainName

varchar(256)

 

11

ConnectionCount

int

 

12

TotalTimeMS

int

 

13

TotalBytes

int

 

14

ReceivedBytes

int

 

15

SentBytes

int

 

12 - Document Tracking Event

ID =

 

Fields Returned (in order)

Data Type (max chars)

12

 

Document Tracking -  Events

 

 

1

RecordedDateTime     

datetime    

 

2

TransID

int

 

3

ComputerDomainName

varchar(255)

 

4

ComputerName

varchar(255)

 

5

FullLoginName

varchar(512)

 

6

DocDeviceType

DocDeviceType

 

7

DocDeviceName

varchar(128)

 

8

DocAction

varchar(12)

 

13 - User Activity

ID =

 

Fields Returned (in order)

Data Type (max chars)

13

 

User Activity - Events

 

 

1

RecordedDateTime     

datetime    

 

2

TransID

int

 

3

ComputerDomainName

varchar(255)

 

4

ComputerName

varchar(255)

 

5

FullLoginName

varchar(512)

 

6

ActionDescription

varchar(50)

 

7

StartDateTime

datetime

 

8

EndDateTime

datetime

 

9

TotalTime

int

 

14 - Online Search  

ID =

 

Fields Returned (in order)

Data Type (max chars)

14

 

Web Search - Online Searches

 

 

1

StartDateTime     

datetime    

 

2

TransID

int

 

3

ComputerDomainName

varchar(255)

 

4

ComputerName

varchar(255)

 

5

FullLoginName

varchar(512)

 

6

ProgramName  

varchar(128)

 

7

TotalTime

int

 

8

FocusTime

int

 

9

ActiveTime

int

 

10

URI

varchar(50)

 

11

HostName

varchar(256)

 

12

DomainName

varchar(256)

 

13

WindowCaption

varchar(128)

 

14

URL

varchar(3072)

Related Topics