-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for custom field(s) logging #267
Comments
Thinking about how this would be implemented in this module, for consistency I feel like it would be another CIM class array under xWebsite (like bindings are today) for per-site logging rules, and a modification to xIisLogging for server-wide config. |
@kittholland that would be the prefered method; add a new param say LogCustomFlags and at a glance your example looks good, only thing I can think off blindly is add vs set |
Let's agree first how configuration should looks like. First example for xIisLogging:
and first example for xWebsite:
Did I understand syntax correctly? |
@kittholland 👍 looks like a great start |
@olljanat That makes sense to me. I implemented this internally as a class based resource, doesn't translate straight over but might be helpful if someone else wants to try to implement. The logic is almost identical for website based vs. server level, just change the xpath filterstring. I could try to make some time for it in the future but won't be able to for awhile, I also havent worked with script based resources or implementing CIM classes before. https://gist.github.com/kittholland/730666229ec9cb7be915768e7d5c9be8 |
- Updated xWebSite to include ability to manage custom logging fields (issue #267).
- Updated xIISLogging to include ability to manage custom logging fields (issue #267)
- Updated xWebSite to include ability to manage custom logging fields (issue dsccommunity#267).
- Updated xIISLogging to include ability to manage custom logging fields (issue dsccommunity#267)
- Updated xWebSite to include ability to manage custom logging fields (issue dsccommunity#267).
- Updated xIISLogging to include ability to manage custom logging fields (issue dsccommunity#267)
Hoping to recycle this issue for Invoke-DscResource since the Invoke-dscresource accepts hashtable and the cim object format causes syntax issue in hashtable. Any workaround is also more than welcome! Function Test-IISLogCustomfield {
[Cmdletbinding()]
Param(
$LogPath = '%SystemDrive%\inetpub\logs\LogFiles'
)
$Logging = @{
LogPath = $LogPath
LogCustomFields = MSFT_xLogCustomFieldInformation {
LogFieldName = 'Original-IP'
SourceName = 'X-Forwarded-For'
SourceType = 'RequestHeader'
};
}
(Invoke-DscResource -Name xIisLogging -Method Test -ModuleName @{ModuleName='xWebAdministration';RequiredVersion='3.2.0'} -Property $Logging).IndesiredState.ToBoolean($_)
} |
We should have support to enable custom field(s) to IIS logging.
I can probably create that feature but how you think that it should be implemented?
Example "X-Forwarded-For" header can be included to logging using this PowerShell command:
Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.applicationHost/sites/siteDefaults/logFile/customFields" -name "." -value @{logFieldName='Original-IP';sourceName='X-Forwarded-For';sourceType='RequestHeader'}
It needs these four parameters:
Do you prefer that this should be included to existing "xIISLogging" and "xWebsite" modules (and if so how to do input validation correct way?) or would it be better idea create new "xIISCustomLogging", etc module?
The text was updated successfully, but these errors were encountered: