Forum Discussion
Frank_Andrusiewicz
Jul 05, 2023Copper Contributor
Azure Logs: KQL Custom function with parameters
This is driving me absolutely insane. I have a case stmt which would be incredibly useful to reuse and yet I can't break it into an KQL custom user function!!! When I "save as" a new function, the screen gives me no options for parameters. When the created function is invoked, the UI indicates "this function expects no parameters". What in the heck is going on???
So, example from another area:
// Query that appends a question mark to a provided name parameter let nameWithQuestionMark = (name:string) { print strcat(name, " is it you?") }; let name = "John"; print nameWithQuestionMark(name);
When I save, I see a window like this:
When I try to use it I get:
nameWithQuestionMark(): function expects 0 argument(s). If the issue persists, please open a support ticket. Request id: "someguid"
EVEN when I check the regular functions here, I see the "add function" screens allow you to specify parameters?!?!?!?
https://learn.microsoft.com/en-us/azure/azure-monitor/logs/functions
Thank you for any help, there must be something simple I'm missing.
*** EDITED TO ADD
this is an app insights insights that's been migrated to workspace based. in Overview I see the workspace specified.
- Solution: I was using the Logs blade on the APPLICATION INSIGHTS service. that has NO ability to have a user function with parameters at all. The only place that exists is on the Workspace level Logs blade. To me? Weird to have things in the interface look absolutely identical and then have weirdly different levels of functionality. So, try to modularize your code in AppInsights logs? No such luck.
- Frank_AndrusiewiczCopper ContributorSolution: I was using the Logs blade on the APPLICATION INSIGHTS service. that has NO ability to have a user function with parameters at all. The only place that exists is on the Workspace level Logs blade. To me? Weird to have things in the interface look absolutely identical and then have weirdly different levels of functionality. So, try to modularize your code in AppInsights logs? No such luck.
- Clive_WatsonBronze ContributorI may just be me, but that screenshot is too small to view. I suspect you haven't missed anything and you'll have to contact support for them to look at this - maybe its a migration issue?
- Frank_AndrusiewiczCopper ContributorI think you're right, a side effect of the migration from classic to workspace based. I will create a case. When I get to the root I'll reply here "for posterity"