FortiSIEM Microsoft SQL Server Scripts

Microsoft SQL Server Scripts

SQL Server Database Level Event Creation Script (PH_Database_Level_Events.sql)

SQL Server DDL Event Creation Script (PH_DDL_Server_Level_Events.sql)

CREATE TRIGGER PH_DDL_Server_Level_Events

ON ALL SERVER

 

FOR DDL_ENDPOINT_EVENTS, DDL_LOGIN_EVENTS, DDL_GDR_SERVER_EVENTS,

DDL_AUTHORIZATION_SERVER_EVENTS,

CREATE_DATABASE, ALTER_DATABASE, DROP_DATABASE

/**FOR DDL_SERVER_LEVEL_EVENTS**/

AS

DECLARE @eventData AS XML;

SET @eventData = EVENTDATA(); /**declare @eventData as XML; set @eventData = EVENTDATA();**/

insert into PH_Events.dbo.DDLEvents(EventTime, EventType, SPID, ServerName, LoginName, ObjectName, ObjectType, SchemaName, DatabaseName, CommandText, XMLEvent) values(cast(@eventData.query(‘data(//PostTime)’) as varchar(64)),        cast(@eventData.query(‘data(//EventType)’) as varchar(128)),        cast(@eventData.query(‘data(//SPID)’) as varchar(128)),        cast(@eventData.query(‘data(//ServerName)’) as varchar(128)),        cast(@eventData.query(‘data(//LoginName)’) as varchar(128)),        cast(@eventData.query(‘data(//ObjectName)’) as varchar(128)),        cast(@eventData.query(‘data(//ObjectType)’) as varchar(128)),        cast(@eventData.query(‘data(//SchemaName)’) as varchar(128)),        cast(@eventData.query(‘data(//DatabaseName)’) as varchar(64)),        cast(@eventData.query(‘data(//TSQLCommand/CommandText)’) as varchar(128)),      /**  DB_NAME(),**/

@eventData);

SQL Server Table Creation Script (PH_EventDB_Tables_Create.sql)

 

SQL Server Trigger Creation Script (PH_LogonEventsTrigger.sql)

This script is to create a server level trigger called PH_LoginEvents. It will record all logon events when a user establishes a session to the database server. The trigger locates at the database server > Server Objects > Triggers.


Having trouble configuring your Fortinet hardware or have some questions you need answered? Ask your questions in the comments below!!! Want someone else to deal with it for you? Get some consulting from Fortinet GURU!

Don't Forget To Buy Your Fortinet Hardware From The Fortinet GURU

Leave a Reply

Name *
Email *
Website

This site uses Akismet to reduce spam. Learn how your comment data is processed.