Skip to content

Instantly share code, notes, and snippets.

@ashtewari
Last active February 13, 2016 23:42
Show Gist options
  • Save ashtewari/c29a8ac98587d42c91bd to your computer and use it in GitHub Desktop.
Save ashtewari/c29a8ac98587d42c91bd to your computer and use it in GitHub Desktop.
$lastDay = ( get-date ).addDays( -1 ).toString( ‘s’ );
$lastHour = ( get-date ).addMinutes( -60 ).toString( ‘s’ );
$searches = @(
"ERROR"
, "source=""tutorialdata.zip:*"" ERROR"
, "CreditDoesNotMatch"
,"source=""tutorialdata.zip:.\\www3/access.log"" productId=WC-SH-G04"
)
Write-Output $lastDay
foreach($search in $searches)
{
$qry = $search + " | stats count"
Write-Output $qry
Search-Splunk -Search $qry -StartTime $lastDay | Select-Object -ExpandProperty Count
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment