gpt4 book ai didi

powershell - Azure DevOps审核日志下载剩余api在给定月份内未下载经过过滤的数据

转载 作者:行者123 更新时间:2023-12-03 01:24:49 26 4
gpt4 key购买 nike

嗨,我无法下载上述提到的持续时间的数据,它会下载所有日志。

$outfile = "/logs.csv"

$connectionToken=""

$base64AuthInfo= [System.Convert]::ToBase64String([System.Text.Encoding]::
ASCII.GetBytes(":$($connectionToken)"))

$AuditLogURL = "https://auditservice.dev.azure.com/{og_name}/_apis/audit/downloadlog?
format=csv&startTime=2020-09-04T00.00.00&endTime=2020-10-05T00.00.00&api-version=6.1-
preview.1"

$AuditInfo = Invoke-RestMethod -Uri $AuditLogURL -Headers @{authorization = "Basic
$base64AuthInfo"} -Method Get –OutFile $outfile
在这里,我提到开始日期为第9个月,但我仍然可以看到第8个月的日志。
这是Microsoft的网址-GET https://auditservice.dev.azure.com/{organization}/_apis/audit/downloadlog?format=json&startTime=2020-09-04T14:05:59.928Z&endTime=2020-10-05T14:05:59.928Z&api-version=6.0-preview.1
我尝试对日期使用相同的格式-startTime = 2019-03-04T14:05:59.928Z&endTime = 2019-03-05T14:05:59.928Z然后返回空文件
如何仅下载选定的月份和时间的过滤数据?
谢谢。

最佳答案

How can I download filtered data for only selected month and time?


出现问题的原因是您在日期格式中使用了 . 而不是 :
正确的日期格式应为:
startTime=2020-09-04T00:00:00&endTime=2020-10-05T00:00:00
时间格式有严格的要求,例如 yyyy-MM-dd'T'HH:mm:ss.SSSz:
yyyy: Year
MM: Month
dd: Day
HH: Hour
mm: Minute
ss: Second
SSS: Millisecond
z: Time zone
对于您的请求,我们甚至可以忽略详细时间,仅保留日期:
startTime=2020-09-04&endTime=2020-10-05
enter image description here
除了,在示例中使用日期格式时仍然得到空文件的原因。 startTime=2019-03-04T14:05:59.928Z&endTime=2019-03-05T14:05:59.928Z。那是因为 Activity 会存储90天,然后将其删除。 :
Access, export, and filter audit logs:

Auditing is turned on by default for all Azure DevOps Servicesorganizations. You can't turn auditing off, which ensures that younever miss an actionable event. Events get stored for 90 days and thenthey’re deleted. However, you can back up audit events to an externallocation to keep the data for longer than the 90-day period.

关于powershell - Azure DevOps审核日志下载剩余api在给定月份内未下载经过过滤的数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64510841/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com