如何解决Powershell 日志 api 不适用于 newrelic1
我正在尝试使用 powershell log-api 功能将一些自定义日志发布到 NewRelic。我遇到以下错误,任何想法或线索都会帮助我。
$Headers = @{“X-Api-Key” = “”}
$Uri = “https://log-api.newrelic.com/log/v1”
$Body = @{
host=“NewHost”;
message=“domain files are missing”;
}
$JSON = $Body | convertto-json
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-RestMethod -Method ‘Post’ -Uri $Uri -Header $Headers -ContentType ‘application/json’ -Body $JSON
在运行上面的命令时,我遇到了以下错误。
At line:1 char:1
Invoke-RestMethod -Method ‘Put’ -Uri $Uri -Header $headers -Body $JSO …
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod],WebExc
eption
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Co ```
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。