PatrickLang / logslurp

This is a development tool to collect logs from Windows Kubernetes nodes deployed with acs-engine
5 stars 5 forks source link

Adding bash wrapper to use Windows with OpenSSH #9

Closed PatrickLang closed 5 years ago

PatrickLang commented 5 years ago

@vyta @jsturtevant - This is a quick update to use the auto-enabled OpenSSH server :) Can you take a quick look? There's one bug left that I think needs to be solved before merge.

Format-List : A positional parameter cannot be found that accepts argument 'README.md'.

Any ideas?

Get-WinEvent : No events were found that match the specified selection criteria.
At line:1 char:854
+ ...  $crashes = Get-WinEvent -FilterHashtable @{logname='Application'; Pr ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (:) [Get-WinEvent], Exception
    + FullyQualifiedErrorId : NoMatchingEventsFound,Microsoft.PowerShell.Commands.GetWinEventCommand

Format-List : A positional parameter cannot be found that accepts argument 'README.md'.
At line:1 char:1767
+ ... fileusage | Format-List Dockerfile README.md logslurp.gif logslurp.ps ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Format-List], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.FormatListCommand

File c:\k\debug\dumpVfpPolicies.ps1 already exists.
File c:\k\debug\hns.psm1 already exists.
File c:\k\debug\starthnstrace.cmd already exists.
File c:\k\debug\startpacketcapture.cmd already exists.
File c:\k\debug\stoppacketcapture.cmd already exists.
WARNING: The names of some imported commands from the module 'hns' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a
list of approved verbs, type Get-Verb.
C:\k\debug\lgmry4ai.sa2
File c:\k\debug\VFP.psm1 already exists.
Logs are available at C:\k\debug\lgmry4ai.sa2
Compressing all logs to 2709k8s010-20190207-082148_logs.zip

    Directory: C:\Users\azureuser

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----         2/7/2019   8:21 PM         175147 2709k8s010-20190207-082148_logs.zip

Connection to 2709k8s010 closed.
vyta commented 5 years ago

Re: Format-List error, I'm not sure exactly why it's happening, but somehow local dir was getting passed in... But I did find that splitting the piping into two parts worked. i.e.


$pageFileUsage = Get-CimInstance win32_pagefileusage | Format-List * ; 
$pageFileUsage | Out-File -Append "$ENV:TEMP\\$($timeStamp)_pagefile.txt";
adelina-t commented 5 years ago

Patrick, how about, as a first iteration, the script would just have the ability to get logs from one windows node ( pretty much what it does now with this PR ) and let node discovery up to kubetest. Given that dump logs will occur after the cluster is deployed, we will have all necessary info to get all nodes from the cluster and call the script for each of them.

The only extra feature needed to this PR would be to change is to also scp for the zip file.

PatrickLang commented 5 years ago

Alright - got SSH working. Will merge