Skip to content

Commit

Permalink
Merge pull request #201 from AfstoneBharfon/update-dcr-api-version
Browse files Browse the repository at this point in the history
[DCR Generator] Updated API version to 2022-06-01 + Fix to Custom Stream Name
  • Loading branch information
AfstoneBharfon authored Dec 4, 2023
2 parents 6c84fb0 + cd0c7e7 commit 45d6074
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ function Get-DCRArmTemplate
$resources = @(
[ordered]@{
"type" = "Microsoft.Insights/dataCollectionRules";
"apiVersion" = "2021-04-01";
"apiVersion" = "2022-06-02";
"name" = "[parameters('$($paramName)')]";
"location" = $Location;
"kind" = $PlatformType;
Expand Down Expand Up @@ -554,21 +554,21 @@ function Get-CustomLogsInDCRFormat

foreach($dataSource in $workspaceDataSourceList)
{
if ($dataSource.Properties -ne $null -and $dataSource.Properties.customLogName -ne $null -and $dataSource.Properties.inputs -ne $null)
if ($null -ne $dataSource.Properties -and $null -ne $dataSource.Properties.customLogName -and $null -ne $dataSource.Properties.inputs)
{
$properties = $dataSource.Properties
$tableName = $properties.customLogName

foreach($input in $properties.inputs)
{
if($input.location -ne $null -and $input.location.fileSystemLocations -ne $null)
if($null -ne $input.location -and $null -ne $input.location.fileSystemLocations)
{
$filePatterns = $null
if($input.location.fileSystemLocations.linuxFileTypeLogPaths -ne $null)
if($null -ne $input.location.fileSystemLocations.linuxFileTypeLogPaths)
{
$filePatterns = $input.location.fileSystemLocations.linuxFileTypeLogPaths
}
elseif($input.location.fileSystemLocations.windowsFileTypeLogPaths -ne $null)
elseif($null -ne $input.location.fileSystemLocations.windowsFileTypeLogPaths)
{
$filePatterns = $input.location.fileSystemLocations.windowsFileTypeLogPaths
}
Expand All @@ -581,7 +581,7 @@ function Get-CustomLogsInDCRFormat
}
}

$dcrCustomLogs.streams += $tableName
$dcrCustomLogs.streams += "Custom-" + $tableName
$dcrCustomLogs.name = $dataSource.Name
$dcrCustomLogs.settings.text = @{
"recordStartTimestampFormat" = "ISO 8601"
Expand Down Expand Up @@ -786,7 +786,7 @@ function Get-DCRStream
$workspaceDataSourceList = Get-AzOperationalInsightsDataSource -ResourceGroupName $ResourceGroupName -WorkspaceName $WorkspaceName -Kind $dataSourceType
foreach($dataSource in $workspaceDataSourceList)
{
if ($dataSource.Properties -ne $null -and $dataSource.Properties.customLogName -ne $null)
if ($null -ne $dataSource.Properties -and $null -ne $dataSource.Properties.customLogName)
{
$stream += "Custom-" + $dataSource.Properties.customLogName
}
Expand Down Expand Up @@ -883,7 +883,7 @@ function Get-CustomLogStreamDeclarations

foreach($dataSource in $workspaceDataSourceList)
{
if($dataSource.Properties -ne $null -and $dataSource.Properties.customLogName -ne $null)
if($null -ne $dataSource.Properties -and $null -ne $dataSource.Properties.customLogName)
{
$streamName = "Custom-" + $dataSource.Properties.customLogName
$streamDeclarations[$streamName] = @{
Expand Down

0 comments on commit 45d6074

Please sign in to comment.