« Previous Next »

Thread: Shared Config + Unique Log Files

Last post 09-25-2009 11:24 AM by Smatchimo. 5 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (6 items)

Sort Posts:

  • 09-17-2009, 1:13 PM

    Shared Config + Unique Log Files

    So we have a farm of let's say 3 web servers, using the shared config option.

    They are all serving shared files from a UNC path (actually a NFS share in Windows 2008 R2 but effectively it's just a UNC path). The log path is also set to a UNC path.

    Is there any way to make each server log to a unique path while still using a shared config? I'd hate to have to disable using shared configs, and have to continually make config changes to each of the servers separately, just to have a unique logging folder... but I'm not sure if they could even all share the same folder since the file would be locked by one server and the others wouldn't be able to write to it.

    I would like to make them all log to a separate folder based on the server's hostnames, such as \\server\logs\%COMPUTERNAME%\w3svc1 ... I don't have time to test that today so I was hoping someone knows if that would work or if there's some other way to use variables in the paths.

    Thanks!

  • 09-17-2009, 3:48 PM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 10:13 PM
    • Redmond, WA
    • Posts 2,343

    Re: Shared Config + Unique Log Files

    You can use environment variables like %COMPUTERNAME% in the path of the directory for logging.  That will work.

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
  • 09-17-2009, 6:11 PM In reply to

    Re: Shared Config + Unique Log Files

    Thanks!

    Ok now I have an even stranger question related that is sure to make you cringe. We are using Client for NFS in 2008 R2 with IIS 7.5, with the files hosted on a Linux NFS server (actually a NFS share on a NetApp SAN in production, but a Linux NFS server in our dev environment).

    We are using an active directory server with the Identity Mapping for UNIX service. Each separate site runs as a unique user that has a unique userid/groupid set. IIS servers the files correctly, i.e. if a site runs as user123 IIS will only serve the files user123 has access to.

    The problem is the actual IIS log files are getting written as the nfsnobody anonymous user, for all sites, which causes problems when we want to let user123 log into a FTP server as user123 and download their log files.

    So in short what seems to be the problem is IIS 7.5 in 2008 R2 does not write the log files as the same user that the site is running as when the logs are on a NFS share... There doesn't seem to be any way to configure what user IIS writes the log files as.

  • 09-17-2009, 8:29 PM In reply to

    Re: Shared Config + Unique Log Files

    I don't know how NFS works, but normally when a file is created, it shouldn't assume the identity of the option writing.  Or is that the way other processes work with NFS when you write files manually.

    Steve Schofield
    Windows Server MVP - IIS
    http://weblogs.asp.net/steveschofield


    http://www.IISLogs.com
    Log archival solution
    Install, Configure, Forget
  • 09-24-2009, 7:12 PM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 10:13 PM
    • Redmond, WA
    • Posts 2,343

    Re: Shared Config + Unique Log Files

    The IIS log files are written by LocalSystem, not the worker process identity, so you would need some way to map LocalSystem (which in a domain would appear as machinename$ account on the network) to an appropriate account in NFS - I don't know details of how NFS works under windows so I cannot say how that will work.  Also, that would mean that you could not isolate log file directories for different sites to different identities.

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
  • 09-25-2009, 11:24 AM In reply to

    Re: Shared Config + Unique Log Files

    Thanks for the replies, yeah we've just settled on moving the files and changing ownership when we archive old log files, if they need to see today's log file we'll just have to get it for them manually.

Page 1 of 1 (6 items)
Microsoft Communities