Reporting

Using c# SavedSearchTemplateArgs hangs report when enumerating stream

a8hill
New Member

The report below runs fine if the value for “Account Name” is hard coded like Account Name=a8hill. If I try to pass the $samaccountname$ parameter as in the code below, Splunk hangs on Line 263 in SearchResultsStreams.cs when enumerating the result. Please advise.

string query = "sourcetype=ADAuditLog:* Account_Name=$samaccountname$ earliest=-day | head 500";

SavedSearchDispatchArgs dispatch = new SavedSearchDispatchArgs(); (OR dispatch = null)

SavedSearchTemplateArgs template = new SavedSearchTemplateArgs();
Argument arg = new Argument("samaccountname", "a8hill");
template.Add(arg);

await service.LogOnAsync(SplunkGlobal.Config.UserName, SplunkGlobal.Config.Password);

SavedSearch savedSearch = await service.SavedSearches.GetOrNullAsync(searchName);

if (savedSearch != null)
{
Job job = await savedSearch.DispatchAsync(dispatch, template);

stream = await job.GetSearchResultsAsync();

foreach (SearchResult result in stream) //HANGS HERE WITH ERROR BELOW
{
    Debug.WriteLine(result);
}
}

Line 263 SearchResultsStreams.cs
Debug.Assert(reader.NodeType == XmlNodeType.EndElement && reader.Name == "results", "Expected: ");

Anthony Hill
ACT AD/Messaging Team

0 Karma

tmackay2015
New Member

Stu, Anthony,
I think this is fixed in release 2.2.5 its availible on github.
-Tom

0 Karma

Stuarth09
Explorer

I've got the same problem, but it seems to occur only when I run a search that returns no results.

0 Karma
Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...