SOLVED

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

Copper Contributor

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
best response confirmed by Stanislav Zhelyazkov (MVP)
Solution

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.

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

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.

1 best response

Accepted Solutions
best response confirmed by Stanislav Zhelyazkov (MVP)
Solution

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.

View solution in original post