saleem-mirza / serilog-sinks-mysql

Serilog sink that writes to MySQL database.
Apache License 2.0
35 stars 25 forks source link

Table structure in MySQL DB #3

Closed HoomanBahreini closed 7 years ago

HoomanBahreini commented 7 years ago

What should be the table sturcture in DB?

I see MS SQL has the following table structure... do I need to use the same for MySQL?

CREATE TABLE [Logs] (
   [Id] int IDENTITY(1,1) NOT NULL,
   [Message] nvarchar(max) NULL,
   [MessageTemplate] nvarchar(max) NULL,
   [Level] nvarchar(128) NULL,
   [TimeStamp] datetimeoffset(7) NOT NULL,  -- use datetime for SQL Server pre-2008
   [Exception] nvarchar(max) NULL,
   [Properties] xml NULL,
   [LogEvent] nvarchar(max) NULL

   CONSTRAINT [PK_Logs] 
     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];
saleem-mirza commented 7 years ago

Just provide a valid connection string with proper permissions, it will create its required table structure.

See https://github.com/saleem-mirza/serilog-sinks-mysql/blob/dev/README.md