Prometheus Windows 事件日志指标

时间:2021-03-17 18:36:48

标签: prometheus

Prometheus 在监控我的服务器时如何收集 Windows 事件日志指标? Prometheus make alert 账号登录失败

prometheus 文本文件收集器 添加powerscript

$DT = [DateTime]::Now.AddDays(-1)
$logName = '{0}{1}_security4625_log_{2}.csv' -f "C:\Program Files\windows_exporter\textfile_inputs\",
 $DT.tostring("MM-dd-yyyy"), $env:Computername
 
Get-EventLog -LogName 'Security' `
 -InstanceId 4625 `
 -After $DT |
 Select-Object @{
  Name='TargetUserName'
  Expression={$_.ReplacementStrings[5]}
 },
 @{
  Name='WorkstationName'
  Expression={$_.ReplacementStrings[1] -replace '\$$'}
 },
 @{
  Name='IpAddress'
  Expression={$_.ReplacementStrings[-2]}
 },
 @{
  **Name='DateTime'
  Expression={$_.ReplacementStrings[-3]}
 },**
 @{
  Name='IpPort'
  Expression={$_.ReplacementStrings[-5]}
 } |
 Export-Csv -Path $logName 

如何在里面添加日期和时间文本文件

0 个答案:

没有答案
相关问题