表設計:
指令碼:
use [master]
gocreate table [dbo].[logloginon](
[id] [bigint] identity(1,1) not null,
[inputloginname] [varchar](50) null,
[clientip] [varchar](15) null,
[memberid] [bigint] null,
[createduserid] [varchar](50) not null,
[createdtime] [datetime2](7) not null,
[lastupdatedtime] [datetime2](7) not null,
[lastupdateduserid] [varchar](50) not null,
[isdeleted] [bit] not null,
[message] [nchar](10) null,
constraint [pk_logloginon] primary key clustered
( [id] asc
)with (pad_index = off, statistics_norecompute = off, ignore_dup_key = off, allow_row_locks = on, allow_page_locks = on) on [primary]
) on [primary]
goset ansi_padding off
goalter table [dbo].[logloginon] add constraint [df_logloginon_createduserid] default ('system') for [createduserid]
goalter table [dbo].[logloginon] add constraint [df_logloginon_createdtime] default (getdate()) for [createdtime]
goalter table [dbo].[logloginon] add constraint [df_logloginon_lastupdatedtime] default (getdate()) for [lastupdatedtime]
goalter table [dbo].[logloginon] add constraint [df_logloginon_lastupdateduserid] default ('system') for [lastupdateduserid]
goalter table [dbo].[logloginon] add constraint [df_logloginon_isdeleted] default ((0)) for [isdeleted]
goexec sys.sp_addextendedproperty @name=n'ms_description', @value=n'標識列' , @level0type=n'schema',@level0name=n'dbo', @level1type=n'table',@level1name=n'logloginon', @level2type=n'column',@level2name=n'id'
goexec sys.sp_addextendedproperty @name=n'ms_description', @value=n'使用者輸入的登入名' , @level0type=n'schema',@level0name=n'dbo', @level1type=n'table',@level1name=n'logloginon', @level2type=n'column',@level2name=n'inputloginname'
goexec sys.sp_addextendedproperty @name=n'ms_description', @value=n'客戶端ip' , @level0type=n'schema',@level0name=n'dbo', @level1type=n'table',@level1name=n'logloginon', @level2type=n'column',@level2name=n'clientip'
goexec sys.sp_addextendedproperty @name=n'ms_description', @value=n'會員表編號' , @level0type=n'schema',@level0name=n'dbo', @level1type=n'table',@level1name=n'logloginon', @level2type=n'column',@level2name=n'memberid'
goexec sys.sp_addextendedproperty @name=n'ms_description', @value=n'建立人(標識)' , @level0type=n'schema',@level0name=n'dbo', @level1type=n'table',@level1name=n'logloginon', @level2type=n'column',@level2name=n'createduserid'
goexec sys.sp_addextendedproperty @name=n'ms_description', @value=n'建立時間(這條業務資料產生的時間)' , @level0type=n'schema',@level0name=n'dbo', @level1type=n'table',@level1name=n'logloginon', @level2type=n'column',@level2name=n'createdtime'
goexec sys.sp_addextendedproperty @name=n'ms_description', @value=n'最後修改時間' , @level0type=n'schema',@level0name=n'dbo', @level1type=n'table',@level1name=n'logloginon', @level2type=n'column',@level2name=n'lastupdatedtime'
goexec sys.sp_addextendedproperty @name=n'ms_description', @value=n'修最後改人(標識)' , @level0type=n'schema',@level0name=n'dbo', @level1type=n'table',@level1name=n'logloginon', @level2type=n'column',@level2name=n'lastupdateduserid'
goexec sys.sp_addextendedproperty @name=n'ms_description', @value=n'邏輯刪除' , @level0type=n'schema',@level0name=n'dbo', @level1type=n'table',@level1name=n'logloginon', @level2type=n'column',@level2name=n'isdeleted'
goexec sys.sp_addextendedproperty @name=n'ms_description', @value=n'登入時返回的訊息' , @level0type=n'schema',@level0name=n'dbo', @level1type=n'table',@level1name=n'logloginon', @level2type=n'column',@level2name=n'message'
go
12 3 2 使用者登入日誌
var log wtmp 和 var log btmp 是linux 系統上用於儲存使用者登入資訊的日誌檔案。其中 wtmp 用於儲存使用者成功登入的記錄,而 btmp 則用於儲存使用者登入失敗的日誌記錄,它們為系統安全審計提供了重要的資訊依據。這兩個檔案都是二進位制的,無法直接使用文字編輯工具開啟...
記錄使用者登入日誌
我們可以在專案中,實現使用者登入日誌記錄。簡單實現方法,如下 在資料中建立一張表,儲存一些相關的資訊。setansi nulls ongo setquoted identifier ongo create table dbo loginlog loginlogid int identity 1 1 ...
Linux檢視登入使用者日誌
一 linux記錄使用者登入資訊檔案 1 var run utmp 記錄當前正在登入系統的使用者資訊 2 var log wtmp 記錄當前正在登入和歷史登入系統的使用者資訊 3 var log btmp 記錄失敗的登入嘗試資訊。二 命令用法 1.命令 last,lastb show a listi...