Subscribe

New-NcClusterLogForward generating a StackOverflowException

The following is what I am getting when using the New-NcClusterLogForward cmdlet. I am using version 4.4 of PowerShell Toolkit. The cluster is ONTAP 9.2 vSIM.

 

Is there a workaround or a fix for this issue that I can implement?

 

Thanks,

 

Chris

 

 

PS C:\Users\chrisj1> import-module dataontap
PS C:\Users\chrisj1> Connect-NcController -Name cj-cluster01.sydlab.netapp.au -Credential (Get-Credential)

cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
Credential

Name                 Address           Vserver              Version
----                 -------           -------              -------
cj-cluster01.sydl... 10.128.57.242                          NetApp Release 9.2: Mon Jun 19 22:20:04 UTC 2017


PS C:\Users\chrisj1> New-NcClusterLogForward -destination git.sydlab.netapp.au -port 514
WARNING: WriteObject: object has no NcController field.

Process is terminated due to StackOverflowException.

 

 

Re: New-NcClusterLogForward generating a StackOverflowException

Hi Chris,

 

I'm not certain what would be causing the cmdlet to crash your powershell session but here is a workaround by invoking the ZAPI.

 

#'------------------------------------------------------------------------------
Param(
   [Parameter(Mandatory=$True, HelpMessage="The cluster to connect to")]   
   [String]$Cluster,
   [Parameter(Mandatory=$True, HelpMessage="The credentials for the cluster")]   
   [System.Management.Automation.PSCredential]$Credentials
)
Import-Module DataONTAP
Connect-NcController -Name $Cluster -HTTPS -Credential $Credentials
$request = New-Object "System.Xml.XmlDocument"
$request.LoadXml("<cluster-log-forward-create>
                     <destination>wfa.testlab.local</destination>
                     <facility>user</facility>
                     <force>false</force>
                     <port>514</port>
                     <protocol>udp-unencrypted</protocol>
                     <return-record>true</return-record>
                     <verify-server>false</verify-server>
                  </cluster-log-forward-create>")
Write-Host "Invoking the 'cluster-log-forward-create' ZAPI"                 
$request.'cluster-log-forward-create'
$response = Invoke-NcSystemApi $request
$response.results."cluster-log-forward-info"
#'------------------------------------------------------------------------------

Here is an example usage:

 

PS C:\Scripts\PowerShell\Projects\CreateClusterLogFoward> .\CreateClusterLogFoward.ps1 -Cluster cluster2.testlab.local -Credentials $credentials

Name                 Address           Vserver              Version
----                 -------           -------              -------
cluster2.testlab.... 192.168.100.3                          NetApp Release 9.1: Thu Dec 22 23:05:58 UTC 2016
Invoking the 'cluster-log-forward-create' ZAPI

destination   : wfa.testlab.local
facility      : user
force         : false
port          : 514
protocol      : udp-unencrypted
return-record : true
verify-server : false

And from the CLI it now shows the cluster log foward configuration:

 

cluster2::> cluster log-forwarding show

                                                Verify  Syslog
Destination Host         Port   Protocol        Server  Facility
------------------------ ------ --------------- ------  --------
wfa.testlab.local        514    udp-unencrypted false   user

Hope that helps

 

/Matt

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.