In Azure Monitoring logs, I have a whole bunch of data being passed from numerous servers and I want to be able to filter out certain records based on the server name being in a list of servers
Something like
AppMessages_CL
| where event contains "memory"
| extend x = parse_json(tostring(event))
| where x.daemon in table('List_of_Servers')
| extend y = parse_json(tostring(x.msg))
| where toint(substring(tostring(y.memory), 0, 3)) >= 200
The problem is that I can’t find any method of storing a static list of server names that I can just refer to.
I can embed the list in the query but I’d prefer to have one single central list for all the different queries.
Any hints would be greatly appreciated.
2
Answers
You can do that by using below way:
Firstly, create Data Collection Endpoint in Monitor in the same region as the Log Analytics Workspace:
Then in Log Analytics Workspace, In Table section Create a table using DCR:
Then provide a name and create a new data collection rule:
Then select the endpoint created before:
Then provide the json file, in which you want to store the server list:
My sample json file contains:
then it looks like below and click on next:
Then table gets created:
Or you can also create table using code. Also check this test-fiddle with let.
Some more options not listened in the other answer:
Azure Storage
Create a CSV file and put in a blob container, you can then reference it like this using a Shared Access Signature:
In memory table