Skip to content
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

Strange output with Get-RubrikEvent -AfterDate parameter #428

Closed
shamsway opened this issue Aug 13, 2019 · 1 comment · Fixed by #429
Closed

Strange output with Get-RubrikEvent -AfterDate parameter #428

shamsway opened this issue Aug 13, 2019 · 1 comment · Fixed by #429

Comments

@shamsway
Copy link
Contributor

Current Behavior:

Running Get-RubrikVM -Name melliott-lin | Get-RubrikEvent -AfterDate 8/12/19 -Verbose against one of our test clusters:

PS /Users/mattelliott/Documents/git/rubrik-sdk-for-powershell> Get-RubrikVM -Name melliott-lin | Get-RubrikEvent -AfterDate 8/12/19 -Verbose
VERBOSE: Validate the Rubrik token exists
VERBOSE: Found a Rubrik token for authentication
VERBOSE: Gather API Data for Get-RubrikEvent
VERBOSE: Selected 1.0 API Data for Get-RubrikEvent
VERBOSE: Load API data for
VERBOSE: Description: Retrieve information for the latest of related events that match the value specified in any of the following categories: type, status, or ID, and limit events by date.
VERBOSE: Build the URI                                                                                                                                                                                                                  VERBOSE: URI = https://cluster-b-rr.rubrik.us/api/internal/event                                                                                                                                                                        VERBOSE: Build the query parameters for object_ids,after_date,object_type,limit,event_type,event_series_id,object_name,status,after_id,show_only_latest,before_date,filter_only_on_latest                                               VERBOSE: URI = https://cluster-b-rr.rubrik.us/api/internal/event?object_ids=VirtualMachine:::2af8fe5f-5b64-44dd-a9e0-ec063753b823-vm-5969&after_date=08/12/2019 00:00:00&limit=50&show_only_latest=False&filter_only_on_latest=False
VERBOSE: Submitting the request
VERBOSE: GET https://cluster-b-rr.rubrik.us/api/internal/event?object_ids=VirtualMachine:::2af8fe5f-5b64-44dd-a9e0-ec063753b823-vm-5969&after_date=08/12/2019 00:00:00&limit=50&show_only_latest=False&filter_only_on_latest=False with 0-byte payload
VERBOSE: received 27-byte response of content type application/json
VERBOSE: Received HTTP Status 200                                                                                                                                                                                                       VERBOSE: Formatting return value                                                                                                                                                                                                        VERBOSE: Filter the results
VERBOSE: Build the URI
VERBOSE: URI = https://cluster-b-rr.rubrik.us/api/internal/event
VERBOSE: Build the query parameters for object_ids,after_date,object_type,limit,event_type,event_series_id,object_name,status,after_id,show_only_latest,before_date,filter_only_on_latest
VERBOSE: URI = https://cluster-b-rr.rubrik.us/api/internal/event?object_ids=VirtualMachine:::1226ff04-6100-454f-905b-5df817b6981a-vm-5969&after_date=08/12/2019 00:00:00&limit=50&show_only_latest=False&filter_only_on_latest=False
VERBOSE: Submitting the request
VERBOSE: GET https://cluster-b-rr.rubrik.us/api/internal/event?object_ids=VirtualMachine:::1226ff04-6100-454f-905b-5df817b6981a-vm-5969&after_date=08/12/2019 00:00:00&limit=50&show_only_latest=False&filter_only_on_latest=False with 0-byte payload
VERBOSE: received 38184-byte response of content type application/json
VERBOSE: Received HTTP Status 200                                                                                                                                                                                                       VERBOSE: Formatting return value                                                                                                                                                                                                        VERBOSE: Filter the results                                                                                                                                                                                                             hasMore data date
------- ---- ----
  False {}
             8/13/19 1:01:41 PM
             8/13/19 1:01:41 PM
             8/13/19 1:01:41 PM
             8/13/19 1:01:41 PM
             8/13/19 1:01:42 PM
             8/13/19 1:01:42 PM
             8/13/19 1:01:42 PM
             8/13/19 1:01:42 PM
             8/13/19 1:01:43 PM
             8/13/19 1:01:59 PM
             8/13/19 1:02:40 PM
             8/13/19 1:02:40 PM
             8/13/19 1:02:41 PM
             8/13/19 1:02:41 PM
             8/13/19 1:02:43 PM
             8/13/19 1:02:43 PM
             8/13/19 1:02:44 PM
             8/13/19 1:02:44 PM
             8/13/19 1:02:15 AM
             8/13/19 1:02:15 AM
             8/13/19 1:02:15 AM
             8/13/19 1:02:15 AM
             8/13/19 1:02:12 AM
             8/13/19 1:02:12 AM
             8/13/19 1:02:11 AM
             8/13/19 1:02:11 AM
             8/13/19 1:01:26 AM
             8/13/19 1:01:10 AM
             8/13/19 1:01:09 AM
             8/13/19 1:01:09 AM
             8/13/19 1:01:09 AM
             8/13/19 1:01:09 AM
             8/13/19 1:01:08 AM
             8/13/19 1:01:08 AM
             8/13/19 1:01:08 AM
             8/13/19 1:01:07 AM
             8/12/19 7:01:29 AM
             8/12/19 7:01:29 AM
             8/12/19 7:01:28 AM
             8/12/19 7:01:28 AM
             8/12/19 7:01:26 AM
             8/12/19 7:01:26 AM
             8/12/19 7:01:25 AM
             8/12/19 7:01:25 AM
             8/12/19 7:00:46 AM
             8/12/19 7:00:30 AM
             8/12/19 7:00:29 AM
             8/12/19 7:00:29 AM
             8/12/19 7:00:29 AM
             8/12/19 7:00:29 AM
VERBOSE: Build the URI
VERBOSE: URI = https://cluster-b-rr.rubrik.us/api/internal/event
VERBOSE: Build the query parameters for object_ids,after_date,object_type,limit,event_type,event_series_id,object_name,status,after_id,show_only_latest,before_date,filter_only_on_latest
VERBOSE: URI = https://cluster-b-rr.rubrik.us/api/internal/event?object_ids=VirtualMachine:::4c0f0c71-1390-4017-9206-f8b16bd7ca8c-vm-5969&after_date=08/12/2019 00:00:00&limit=50&show_only_latest=False&filter_only_on_latest=False
VERBOSE: Submitting the request
VERBOSE: GET https://cluster-b-rr.rubrik.us/api/internal/event?object_ids=VirtualMachine:::4c0f0c71-1390-4017-9206-f8b16bd7ca8c-vm-5969&after_date=08/12/2019 00:00:00&limit=50&show_only_latest=False&filter_only_on_latest=False with 0-byte payload
VERBOSE: received 27-byte response of content type application/json
VERBOSE: Received HTTP Status 200                                                                                                                                                                                                       VERBOSE: Formatting return value                                                                                                                                                                                                        VERBOSE: Filter the results                                                                                                                                                                                                               False {}

Expected Behavior:

Cmdlet should display Event info as it does when not using -AfterDate parameter

Steps to Reproduce:

Please provide detailed steps for reproducing the issue.

  1. Get-RubrikVM -Name [vmname] | Get-RubrikEvent -AfterDate 8/12/19

Context:

  • Rubrik PowerShell Module Version: 4.0.0.183
  • PowerShell Version: 6.2.1
  • Operating System: MacOS 10.14.6

Failure Logs

N/A

@jaapbrasser
Copy link
Contributor

Hello Matt,

I have taken a look at this issue, this seems to be caused by the default PowerShell behavior of displayings arrays, or multiple arrays of objects.

What happens in the console is that the output of the second array is determined by the output of the first array. So for example, using different cmdlets you can see the difference in output:

get-item /;get-process | select -first 1
get-item /
get-process | select -first 1

That being said, your issue does highlight two issues with the Get-RubrikEvent function as it behaves now. It should not be outputting the empty json response. And the Convert-APIDateTime function should only be called if the time field actually exists. I have created a branch and started work on resolving these issues.

@jaapbrasser jaapbrasser self-assigned this Aug 14, 2019
shamsway added a commit that referenced this issue Aug 14, 2019
Added time property validation to Get-RubrikEvent - Issue #428
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants