-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
xIisLogging and xWebsite: Add Ensure property to LogCustomFields (#576)
- Website - Add Ensure to LogCustomFieldInformation. (issue #571) - IisLogging - Can now remove all LogCustomFields using Ensure. (issue #571)
- Loading branch information
Showing
17 changed files
with
653 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
source/Examples/Resources/IisLogging/Sample_IisLogging_LogCustomFields_EnsureAbsent.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
configuration Sample_IisLogging_LogCustomFields_EnsureAbsent | ||
{ | ||
param | ||
( | ||
# Target nodes to apply the configuration | ||
[String[]] $NodeName = 'localhost' | ||
) | ||
|
||
# Import the module that defines custom resources | ||
Import-DscResource -Module WebAdministrationDsc | ||
|
||
Node $NodeName | ||
{ | ||
IisLogging Logging | ||
{ | ||
LogPath = 'C:\IISLogFiles' | ||
Logflags = @('Date','Time','ClientIP','ServerIP','UserAgent') | ||
LogFormat = 'W3C' | ||
LogTargetW3C = 'File,ETW' | ||
LogCustomFields = @( | ||
DSC_LogCustomField | ||
{ | ||
LogFieldName = 'ClientEncoding' | ||
SourceName = 'Accept-Encoding' | ||
SourceType = 'RequestHeader' | ||
Ensure = 'Absent' | ||
} | ||
) | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
.../Examples/Resources/IisLogging/Sample_IisLogging_LogCustomFields_EnsurePresentDefault.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
configuration Sample_IisLogging_LogCustomFields_EnsurePresentDefault | ||
{ | ||
param | ||
( | ||
# Target nodes to apply the configuration | ||
[String[]] $NodeName = 'localhost' | ||
) | ||
|
||
# Import the module that defines custom resources | ||
Import-DscResource -Module WebAdministrationDsc | ||
|
||
Node $NodeName | ||
{ | ||
IisLogging Logging | ||
{ | ||
LogPath = 'C:\IISLogFiles' | ||
Logflags = @('Date','Time','ClientIP','ServerIP','UserAgent') | ||
LogFormat = 'W3C' | ||
LogTargetW3C = 'File,ETW' | ||
LogCustomFields = @( | ||
DSC_LogCustomField | ||
{ | ||
LogFieldName = 'ClientEncoding' | ||
SourceName = 'Accept-Encoding' | ||
SourceType = 'RequestHeader' | ||
} | ||
) | ||
} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
...amples/Resources/IisLogging/Sample_IisLogging_LogCustomFields_EnsurePresentExplicitly.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
configuration Sample_IisLogging_LogCustomFields_EnsurePresentExplicitly | ||
{ | ||
param | ||
( | ||
# Target nodes to apply the configuration | ||
[String[]] $NodeName = 'localhost' | ||
) | ||
|
||
# Import the module that defines custom resources | ||
Import-DscResource -Module WebAdministrationDsc | ||
|
||
Node $NodeName | ||
{ | ||
IisLogging Logging | ||
{ | ||
LogPath = 'C:\IISLogFiles' | ||
Logflags = @('Date','Time','ClientIP','ServerIP','UserAgent') | ||
LogFormat = 'W3C' | ||
LogTargetW3C = 'File,ETW' | ||
LogCustomFields = @( | ||
DSC_LogCustomField | ||
{ | ||
LogFieldName = 'ClientEncoding' | ||
SourceName = 'Accept-Encoding' | ||
SourceType = 'RequestHeader' | ||
Ensure = 'Present' | ||
} | ||
) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
source/Examples/Resources/WebSite/Sample_WebSite_WithCustomLogFields_EnsureAbsent.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
configuration Sample_WebSite_WithCustomLogFields_EnsureAbsent | ||
{ | ||
param | ||
( | ||
# Target nodes to apply the configuration | ||
[String[]] | ||
$NodeName = 'localhost', | ||
|
||
# Name of the website to create | ||
[Parameter(Mandatory = $true)] | ||
[ValidateNotNullOrEmpty()] | ||
[String] | ||
$WebSiteName, | ||
|
||
# Optional Site Id for the website | ||
[Parameter()] | ||
[UInt32] | ||
$SiteId, | ||
|
||
# Source Path for Website content | ||
[Parameter(Mandatory = $true)] | ||
[ValidateNotNullOrEmpty()] | ||
[String] | ||
$SourcePath, | ||
|
||
# Destination path for Website content | ||
[Parameter(Mandatory = $true)] | ||
[ValidateNotNullOrEmpty()] | ||
[String] | ||
$DestinationPath | ||
) | ||
|
||
# Import the module that defines custom resources | ||
Import-DscResource -Module WebAdministrationDsc, PSDesiredStateConfiguration | ||
|
||
Node $NodeName | ||
{ | ||
# Install the IIS role | ||
WindowsFeature IIS | ||
{ | ||
Ensure = 'Present' | ||
Name = 'Web-Server' | ||
} | ||
|
||
# Install the ASP .NET 4.5 role | ||
WindowsFeature AspNet45 | ||
{ | ||
Ensure = 'Present' | ||
Name = 'Web-Asp-Net45' | ||
} | ||
|
||
# Stop the default website | ||
WebSite DefaultSite | ||
{ | ||
Ensure = 'Present' | ||
Name = 'Default Web Site' | ||
State = 'Stopped' | ||
ServerAutoStart = $false | ||
PhysicalPath = 'C:\inetpub\wwwroot' | ||
DependsOn = '[WindowsFeature]IIS' | ||
} | ||
|
||
# Copy the website content | ||
File WebContent | ||
{ | ||
Ensure = 'Present' | ||
SourcePath = $SourcePath | ||
DestinationPath = $DestinationPath | ||
Recurse = $true | ||
Type = 'Directory' | ||
DependsOn = '[WindowsFeature]AspNet45' | ||
} | ||
|
||
# Create the new Website | ||
WebSite NewWebsite | ||
{ | ||
Ensure = 'Present' | ||
Name = $WebSiteName | ||
SiteId = $SiteId | ||
State = 'Started' | ||
ServerAutoStart = $true | ||
PhysicalPath = $DestinationPath | ||
DependsOn = '[File]WebContent' | ||
LogFlags = @('Date','Time','ClientIP','ServerIP','UserAgent') | ||
LogFormat = 'W3C' | ||
LogCustomFields = @( | ||
DSC_LogCustomFieldInformation | ||
{ | ||
LogFieldName = 'ClientEncoding' | ||
SourceName = 'Accept-Encoding' | ||
SourceType = 'RequestHeader' | ||
Ensure = 'Absent' | ||
} | ||
) | ||
} | ||
} | ||
} |
Oops, something went wrong.