SOLVED
Home

Using REST endpoint to add log data, can i set the MetricName value?

Highlighted
Jason Perron
New Contributor

Using REST endpoint to add log data, can i set the MetricName value?

Disclaimer that i am new to OMS.  I am using the ods.opinsights.azure.com/api/logs?api-version=2016-04-01 endpoint to save log entries to OMS.  I am sending the messages as JSON which automatically creates new columns and filters for me in OMS.  The properties it creates are generally suffixed with "_s" for string or "_g" for guid.  I noticed there is a property already available called "MetricName" but when i try to set a value for it in my log entry, it adds a column called "MetricName_s".  The same message also has the property DurationMs and that gets set fine. 

 

My question is, how can i set the MetricName property on a log entry when posting to a REST endpoint.

 

Tank you,

Jason

3 Replies
Solution

Re: Using REST endpoint to add log data, can i set the MetricName value?

Hi

When you send particular field/column to Log Analytics its name is changed based on the type. This is true for almost any field/column. However there are some fields/columns which are called reserved that you can send without name change if you send them in the right type of course. I've covered this topic here:

 

https://cloudadministrator.wordpress.com/2017/05/24/reserved-common-fields-in-log-analytics/

 

MetricName is not such a field/column.

Re: Using REST endpoint to add log data, can i set the MetricName value?

I'm still a little confused.  Why is it that DurationMs doesn't suffix anything, but MetricName does?  

 

From my understanding, you can do auto-scaling based on a metricname/value so i was hoping to be able to upload app specific timings in order to support scaling.  Seems silly that i would have to create a custom field for a field already there

Re: Using REST endpoint to add log data, can i set the MetricName value?

Hi

I am not sure what you mean by auto-scaling. There are just some fields that are common for all tables and some that are created when uploading data. No matter how a filed is named that should not be a problem to cover any scenario that you have in mind. The query language itself is so powerful that you can even rename and extend the data while querying.

Related Conversations
No Assignments Tab in Microsoft Teams
Nick Davies  in  Microsoft Teams  on
24 Replies
Create private channel in a team
Catalin Prata  in  Microsoft Teams  on
45 Replies
Multiple language settings in Teams?
Suzannah Calvery  in  Microsoft Teams  on
2 Replies
How do I control who can make Teams?
Ryan B Partlow  in  Microsoft Teams  on
8 Replies
No Team Channel Notifications
Jake Baldwin  in  Microsoft Teams  on
66 Replies