一、安装LogParser
https://www.microsoft.com/en-us/download/details.aspx?id=24659
二、将日志导入到SqlServer数据库
打开cmd切换到LogParser安装目录
假设日志目录为F:iislogs
导入该目录下所有log文件:
logparser "SELECT * FROM F:iislogs* TO iislogs" -i:IISW3C -o:SQL -server:. -driver:"SQL Server" -database:Test -username:sa -password:123456 -createtable:ON
或导入其中一文件:
logparser "SELECT * FROM F:iislogsu_ex161231.log TO iislogs" -i:IISW3C -o:SQL -server:. -driver:"SQL Server" -database:Test -username:sa -password:123456 -createtable:ON