Search code examples
powershelliisdsc

Does desired state configuration support specifying custom log field names for IIS server logs


I have googled Desired State Configuration and checked the Microsoft site for information on specifying settings for IIS servers, specifically using DSC to make IIS servers STIG compliant. Unfortunately, I can't find many details specifically for IIS web server setting. Any recommendations or code examples would be greatly appreciated.


Solution

  • To set the Custom Logging Fields name in iis you could use the below PowerShell command:

    New-ItemProperty 'IIS:\Sites\Default Web Site' -Name logfile.customFields.collection -Value @{logFieldName='testname';sourceType='RequestHeader';sourceName='c-ip'}
    

    enter image description here