我在Azure云中有一个Umbraco实例,v4.7,如果内存服务正确的话。我需要利用IIS日志记录来获取网站使用统计数据,但似乎有一个限制。
我有多个不同的网站,都使用不同的网站模板,但IIS日志似乎没有输出域名。如何让IIS输出域名?
下面是当前IIS日志捕获的示例(我知道这是一个机器人爬行网页,但我有真正的流量,但不能识别哪个网站被访问):
2012-08-06 00:11:54 10.61.52.73 GET /保险/保险/- 80 - 46.4.38.67 InnovantageBot/1.0+(http://www.innovantage.co.uk/technology/webmaster_information.htm) 200 0 0 390 2012-08-06 00:11:55 10.61.52.73 GET /保险/原因/- 80 - 46.4.38.67 InnovantageBot/1.0+(http://www.innovantage.co.uk/technology/webmaster_information.htm) 200 0 578 2012-08-06 00:11:55 10.61.52.73 GET /保险/类型/- 80 00:11:55 10.61.52.73 GET /life/qa/ - 80 - 46.4.38.67 InnovantageBot/1.0+(http://www.innovantage.co.uk/technology/webmaster_information.htm) 200 0 0 359 2012-08-06 00:11:55 10.61.52.73 GET /life/reasons/ - 80 - 46.4.38.67 InnovantageBot/1.0+(http://www.innovantage.co.uk/technology/webmaster_information.htm) 200 0 0328 2012-08-06 00:11:57 10.61.52.73 GET /保险/术语表/- 80 -46.4.38.67 InnovantageBot/1.0+(http://www.innovantage.co.uk/technology/webmaster_information.htm) 200 0 0 374
发布于 2012-08-07 22:57:42
在您的WebRole.cs中,您可以调整IIS和在IIS中运行的每个站点。您可以选择应该记录哪些字段,我认为您正在寻找LogExtFileFlags.Host字段:
using (var manager = new ServerManager())
{
var siteName = RoleEnvironment.CurrentRoleInstance.Id + "_Web";
var site = manager.Sites[siteName];
site.LogFile.LogExtFileFlags |= LogExtFileFlags.Host;
manager.CommitChanges();
}确保您的角色在提升模式下运行,请在ServiceDefinition.csdef文件中更改此设置:
<Runtime executionContext="elevated" />此外,您还应该能够使用appcmd.exe更改此设置
http://www.iis.net/ConfigReference/system.applicationHost/sites/siteDefaults/logFile#005
https://stackoverflow.com/questions/11847282
复制相似问题