Summary Table

Categories Total Count
PII 0
URL 0
DNS 0
EKL 0
IP 0
PORT 0
VsID 0
CF 0
AI 0
VPD 0
PL 0
Other 0

File Content

?CREATE TABLE dbo.WebLogs
(
--fields
WebLogID [bigint] IDENTITY(1,1) NOT NULL,
ADDomain [varchar] (20),
UserName [varchar] (60),
RequestDate [datetime2](7),
RemoteAddress [varchar](50),
RequestPage [varchar](100),
ActionType [varchar](50),
RecordID [varchar](50),
WebMessage [varchar](4000),
ActionCriteria [xml],

--primary key
CONSTRAINT PK_WebLogs PRIMARY KEY CLUSTERED
(
WebLogID ASC
)

--unique key (if any)
)
ON AuditData
--when using clustered columnstore index, can't set data compression to PAGE
WITH (DATA_COMPRESSION = PAGE)
GO

--foreign keys

--indexes
CREATE NONCLUSTERED INDEX IX_WebLogs_ADDomain ON dbo.WebLogs
(
ADDomain
) WITH (
PAD_INDEX = ON, --If want to use a Fill Factor, then PAD_INDEX must = ON
FILLFACTOR = 80, --100 = max fill; set to 90 if going to insert new values incrementally; 100 if doing bulk load
SORT_IN_TEMPDB = ON, -- sorts the index in the TempDB; default = OFF
IGNORE_DUP_KEY = OFF,
STATISTICS_NORECOMPUTE = OFF,
STATISTICS_INCREMENTAL = OFF,
DROP_EXISTING = OFF,
ONLINE = OFF,
ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON,
MAXDOP = 0, --degrees of parallelism, controls how many CPUs to use; 0 = default (all available), max = 64
DATA_COMPRESSION = PAGE --use page compression; default = NONE
)
ON AuditIndex
GO

CREATE NONCLUSTERED INDEX IX_WebLogs_UserName ON dbo.WebLogs
(
UserName
) WITH (
PAD_INDEX = ON, --If want to use a Fill Factor, then PAD_INDEX must = ON
FILLFACTOR = 80, --100 = max fill; set to 90 if going to insert new values incrementally; 100 if doing bulk load
SORT_IN_TEMPDB = ON, -- sorts the index in the TempDB; default = OFF
IGNORE_DUP_KEY = OFF,
STATISTICS_NORECOMPUTE = OFF,
STATISTICS_INCREMENTAL = OFF,
DROP_EXISTING = OFF,
ONLINE = OFF,
ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON,
MAXDOP = 0, --degrees of parallelism, controls how many CPUs to use; 0 = default (all available), max = 64
DATA_COMPRESSION = PAGE --use page compression; default = NONE
)
ON AuditIndex
GO

CREATE NONCLUSTERED INDEX IX_WebLogs_RequestDate ON dbo.WebLogs
(
RequestDate
) WITH (
PAD_INDEX = ON, --If want to use a Fill Factor, then PAD_INDEX must = ON
FILLFACTOR = 80, --100 = max fill; set to 90 if going to insert new values incrementally; 100 if doing bulk load
SORT_IN_TEMPDB = ON, -- sorts the index in the TempDB; default = OFF
IGNORE_DUP_KEY = OFF,
STATISTICS_NORECOMPUTE = OFF,
STATISTICS_INCREMENTAL = OFF,
DROP_EXISTING = OFF,
ONLINE = OFF,
ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON,
MAXDOP = 0, --degrees of parallelism, controls how many CPUs to use; 0 = default (all available), max = 64
DATA_COMPRESSION = PAGE --use page compression; default = NONE
)
ON AuditIndex
GO

CREATE NONCLUSTERED INDEX IX_WebLogs_RequestPage ON dbo.WebLogs
(
RequestPage
) WITH (
PAD_INDEX = ON, --If want to use a Fill Factor, then PAD_INDEX must = ON
FILLFACTOR = 80, --100 = max fill; set to 90 if going to insert new values incrementally; 100 if doing bulk load
SORT_IN_TEMPDB = ON, -- sorts the index in the TempDB; default = OFF
IGNORE_DUP_KEY = OFF,
STATISTICS_NORECOMPUTE = OFF,
STATISTICS_INCREMENTAL = OFF,
DROP_EXISTING = OFF,
ONLINE = OFF,
ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON,
MAXDOP = 0, --degrees of parallelism, controls how many CPUs to use; 0 = default (all available), max = 64
DATA_COMPRESSION = PAGE --use page compression; default = NONE
)
ON AuditIndex
GO

CREATE NONCLUSTERED INDEX IX_WebLogs_ActionType ON dbo.WebLogs
(
ActionType
) WITH (
PAD_INDEX = ON, --If want to use a Fill Factor, then PAD_INDEX must = ON
FILLFACTOR = 80, --100 = max fill; set to 90 if going to insert new values incrementally; 100 if doing bulk load
SORT_IN_TEMPDB = ON, -- sorts the index in the TempDB; default = OFF
IGNORE_DUP_KEY = OFF,
STATISTICS_NORECOMPUTE = OFF,
STATISTICS_INCREMENTAL = OFF,
DROP_EXISTING = OFF,
ONLINE = OFF,
ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON,
MAXDOP = 0, --degrees of parallelism, controls how many CPUs to use; 0 = default (all available), max = 64
DATA_COMPRESSION = PAGE --use page compression; default = NONE
)
ON AuditIndex
GO

--constraints

--Metadata descriptions for each field
EXECUTE sp_addextendedproperty
N'MS_Description', N'Primary Key, unique to EPRS',
N'SCHEMA', N'dbo',
N'TABLE', N'WebLogs',
N'COLUMN', N'WebLogID'
GO

EXECUTE sp_addextendedproperty
N'MS_Description', N'Windows Active Directory domain where the user is logging in from',
N'SCHEMA', N'dbo',
N'TABLE', N'WebLogs',
N'COLUMN', N'ADDomain'
GO

EXECUTE sp_addextendedproperty
N'MS_Description', N'AD Account for the person',
N'SCHEMA', N'dbo',
N'TABLE', N'WebLogs',
N'COLUMN', N'UserName'
GO

EXECUTE sp_addextendedproperty
N'MS_Description', N'Date of the web action',
N'SCHEMA', N'dbo',
N'TABLE', N'WebLogs',
N'COLUMN', N'RequestDate'
GO

EXECUTE sp_addextendedproperty
N'MS_Description', N'Internet protocol address of the web action',
N'SCHEMA', N'dbo',
N'TABLE', N'WebLogs',
N'COLUMN', N'RemoteAddress'
GO

EXECUTE sp_addextendedproperty
N'MS_Description', N'Name of the web page',
N'SCHEMA', N'dbo',
N'TABLE', N'WebLogs',
N'COLUMN', N'RequestPage'
GO

EXECUTE sp_addextendedproperty
N'MS_Description', N'Describes the action that occured',
N'SCHEMA', N'dbo',
N'TABLE', N'WebLogs',
N'COLUMN', N'ActionType'
GO

EXECUTE sp_addextendedproperty
N'MS_Description', N'Record identifier, variable key',
N'SCHEMA', N'dbo',
N'TABLE', N'WebLogs',
N'COLUMN', N'RecordID'
GO

EXECUTE sp_addextendedproperty
N'MS_Description', N'Custom message, could be a description note or an error message',
N'SCHEMA', N'dbo',
N'TABLE', N'WebLogs',
N'COLUMN', N'WebMessage'
GO

EXECUTE sp_addextendedproperty
N'MS_Description', N'XML-based data type that reflects the actions taken or criteria selected',
N'SCHEMA', N'dbo',
N'TABLE', N'WebLogs',
N'COLUMN', N'ActionCriteria'
GO