SOLVED
Home

Time Range selection for stored functions via command line possible ?

Highlighted
Emilian Ertel
Occasional Contributor

Is there a way to select the Time Range programmatically (not via the drop down menu "Select Time Range") for which a stored function shall be executed ?

Even if the stored function specifies a Time Range in the query, when invoking it, the specified Time Range is not "recognized".

 

Example:

--- stored function "MyCountFunction" ---

let starttime = startofday(ago(2d));
let endtime = endofday(ago(1d));
MyCustomLog_CL
| where TimeGenerated between(starttime..endtime)
| count
--- end of stored function ---
 
--- invocation in the Analytics portal ---
workspace("myworkspace").MyCountFunction
 
The Time Range for the invocation can only be changed from the drop down menu (which makes a programmatic query impossible).

Does anyone know a workaround for this ?
 
tnx //emil.
 
2 Replies

Hi Emil,

You're right. This seems to be a bug in the UI, caused by the fact the time range is not explicitly found in the query text (makes sense when calling functions).

As a workaround, I suggest you add any mention of "TimeGenerated" in your query, such as:

call_to_function() | ... where TimeGenerated != ""
FYI - the issue should not occur when calling functions programmatically.
 
Thanks,
Noa
Solution

hi Noa,

 

thanks - you are right, the API call works perfectly, the bug only affects the UI.

 

The UI bug should not be a problem, the workaround you proposed solves it.

 

Thanks !

 

bye //emil.

 

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
35 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
9 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
29 Replies