少量の更新ですが、いろいろ整理しました。
利用できるfunction一覧です。
CommandType Name ModuleName ----------- ---- ---------- Function Get-PSSumoLogicApiCollector PSSumoLogicAPI Function Get-PSSumoLogicApiCollectorSource PSSumoLogicAPI Function Get-PSSumoLogicApiCredential PSSumoLogicAPI Function New-PSSumoLogicApiCredential PSSumoLogicAPI Function Remove-PSSumoLogicApiCollector PSSumoLogicAPI Function Remove-PSSumoLogicApiCollectorSource PSSumoLogicAPI Function Set-PSSumoLogicApiCollectorSource PSSumoLogicAPI
できることはこれらです。
API認証
アクセスID認証
今のところはBasic認証です。さっきみたら、アクセスIDとかあったのでこれで認証できたらうれしいなぁとか。*1
Basic認証
認証保持
ユーザー名とパスワードを入力することで、ファイルに保持します。 作ったファイルにかかれているのは、暗号化されたパスワードで復号は認証を作ったPCでのみ可能です。
Userパラメータを省略した場合、configで指定したユーザーがデフォルトでUserに入ります。
SYNTAX
New-PSSumoLogicApiCredential [[-path] <string>] [[-User] <string>] [<CommonParameters>]
認証再利用
作成した認証ファイルを読み込んで、パスワードを復号しPSCredentialを作ります。
configで指定したユーザーがデフォルトでUserに入ります。
Get-PSSumoLogicApiCredential
Collector
取得
Collector情報を取得します。これないとGUIでとか死にます。
SYNTAX
Get-PSSumoLogicApiCollector [[-Id] <int[]>] [[-Credential] <pscredential>] [[-Async]] [<CommonParameters>]
CollectorIdを指定することで、そのコレクターだけになるので処理が軽くなります。
Get-PSSumoLogicApiCollector -Id 111111
CollectorIdを指定したときに -Asyncスイッチを使うとRunSpaceを使って各Collectorに対して非同期に取得します。対象Collectorが2個以上なら使うべきです。
Get-PSSumoLogicApiCollector -Id 111111 -Async
設定
新規コレクターは、インストーラが通信を取れたときに行うのでAPIにありません。 あるいは、Sumo.confで行います。
削除
-IdでCollectorIdを指定してください。*2
SYNTAX
Remove-PSSumoLogicApiCollector [[-Id] <int[]>] [[-Credential] <pscredential>] [[-Async]] [<CommonParameters>]
Source
取得
Collectorで取得するSourceの設定です。これないと一個一個確認とか無理です。
SYNTAX
Get-PSSumoLogicApiCollectorSource [[-CollectorId] <int[]>] [[-Id] <int[]>] [[-Credential] <pscredential>] [[-Async]] [<CommonParameters>]
CollectorIdとSourceIdを指定することで、対象が絞られ軽くなります。
Get-PSSumoLogicApiCollectorSource -CollectorId 111111 -Id 123
CollectorIdを指定したときに -Asyncスイッチを使うとRunSpaceを使って各Collectorに対して非同期に取得します。対象Collectorが2個以上なら使うべきです。
Get-PSSumoLogicApiCollectorSource -CollectorId 111111,111112,11113 -Async
設定
指定したCollectorIdにSourceを設定します。パラメータ多いですね。禿げます。
SYNTAX
Set-PSSumoLogicApiCollectorSource
[[-Id] <int[]>]
[-pathExpression] <string>]
[-name] <string>]
[-sourceType] <string> {LocalFile | RemoteFile | LocalWindowsEventLog | RemoteWindowsEventLog | Syslog | Script | Alert | AmazonS3 | HTTP}]
[-category] <string>]
[-description] <string>]
[[-alive] <bool>]
[[-states] <string>]
[[-automaticDateParsing] <bool>]
[[-timeZone] <string>]
[[-multilineProcessingEnabled] <bool>]
[[-Credential] <pscredential>]
[[-Async]]
[<CommonParameters>]
削除
指定したCollectorIdのSourceIdを削除します。やり直し便利です。*3
SYNTAX
Remove-PSSumoLogicApiCollectorSource [[-CollectorId] <int[]>] [[-Id] <int[]>] [[-Credential] <pscredential>] [[-Async]] [<CommonParameters>]
おわり
ここまで書いて、あ、パイプラインサポートしておくかと思って実装しました。
が、テストしてて、あ、SumoせんせーのAPI応答自体が遅いしPowerShellのパイプラインって順次ストリーム処理だからAsync意味ないしむしろ劇的に遅くなった。しょんぼり。