{"id":523,"date":"2018-07-20T11:56:55","date_gmt":"2018-07-20T11:56:55","guid":{"rendered":"http:\/\/www.ciraltos.com\/?p=523"},"modified":"2018-07-21T12:45:02","modified_gmt":"2018-07-21T12:45:02","slug":"azure-oms-log-analytics-step-by-step-data-collector-api","status":"publish","type":"post","link":"https:\/\/www.ciraltos.com\/staging2\/azure-oms-log-analytics-step-by-step-data-collector-api\/","title":{"rendered":"Azure OMS Log Analytics Step by Step \u2013 Data Collector API"},"content":{"rendered":"<p><img decoding=\"async\" loading=\"lazy\" class=\"alignleft size-thumbnail wp-image-462\" src=\"\/wp-content\/uploads\/2018\/04\/OMS_Icon-150x150.png\" alt=\"\" width=\"150\" height=\"150\" \/>I see a lot of potential in Azure Log Analytics. That should go without saying considering the amount of time I have spent learning and documenting it over the past few weeks. One of the most exciting features that adds tremendous flexibility is the ability to log directly to Log Analytics with the Web API. Logging to the Web API enables anything to be written to Log Analytics without the use of the Microsoft Monitoring agent.<!--more--><\/p>\n<p><iframe loading=\"lazy\" src=\"https:\/\/www.youtube.com\/embed\/6ML-MB4lpmY\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<p>In this video I go over writing data directly to Log Analytics with the HTTP Data Collector API using PowerShell. The goal was to create a universal way to write any data to log analytics. I did this by creating a function that takes the date, the log Type and a hashtable of key and data pairs and writes it to a Log Analytics workspace.<\/p>\n<p>The function can be added to a script and used to send data directly to Log Analytics. I use it in a Module added to Azure Automation. From there I can write data to Log Analytics from any Azure Automation Runbooks. Once in Log Analytics, I can trigger alerts or tie into Logic Apps to kick off other Run Books, alerts or webhooks to other systems.<\/p>\n<p>Additional data can be found here:<br \/>\n<a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/log-analytics\/log-analytics-data-collector-api\" target=\"_blank\" rel=\"noopener\">https:\/\/docs.microsoft.com\/en-us\/azure\/log-analytics\/log-analytics-data-collector-api<\/a><br \/>\n<a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/log-analytics\/log-analytics-data-ingestion-time\" target=\"_blank\" rel=\"noopener\">https:\/\/docs.microsoft.com\/en-us\/azure\/log-analytics\/log-analytics-data-ingestion-time<\/a><\/p>\n<p>The function can be found here:<br \/>\n<a href=\"https:\/\/github.com\/tsrob50\/LogAnalyticsAPIFunction\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/tsrob50\/LogAnalyticsAPIFunction<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I see a lot of potential in Azure Log Analytics. That should go without saying considering the amount of time I have spent learning and documenting it over the past few weeks. One of the most exciting features that adds tremendous flexibility is the ability to log directly to Log Analytics with the Web API. &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/www.ciraltos.com\/staging2\/azure-oms-log-analytics-step-by-step-data-collector-api\/\"> <span class=\"screen-reader-text\">Azure OMS Log Analytics Step by Step \u2013 Data Collector API<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-global-header-display":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":""},"categories":[2,170],"tags":[240,230,9,210,241,242,194,199,202,239],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Azure OMS Log Analytics Step by Step \u2013 Data Collector API - ciraltos<\/title>\n<meta name=\"description\" content=\"In this post and video I go over writing data directly to Log Analytics with the HTTP Data Collector API using PowerShell.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/www.ciraltos.com\/staging2\/azure-oms-log-analytics-step-by-step-data-collector-api\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Azure OMS Log Analytics Step by Step \u2013 Data Collector API - ciraltos\" \/>\n<meta property=\"og:description\" content=\"In this post and video I go over writing data directly to Log Analytics with the HTTP Data Collector API using PowerShell.\" \/>\n<meta property=\"og:url\" content=\"http:\/\/www.ciraltos.com\/staging2\/azure-oms-log-analytics-step-by-step-data-collector-api\/\" \/>\n<meta property=\"og:site_name\" content=\"ciraltos\" \/>\n<meta property=\"article:published_time\" content=\"2018-07-20T11:56:55+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-07-21T12:45:02+00:00\" \/>\n<meta name=\"author\" content=\"Travis Roberts\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ciraltos\" \/>\n<meta name=\"twitter:site\" content=\"@ciraltos\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Travis Roberts\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/azure-oms-log-analytics-step-by-step-data-collector-api\/#article\",\"isPartOf\":{\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/azure-oms-log-analytics-step-by-step-data-collector-api\/\"},\"author\":{\"name\":\"Travis Roberts\",\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a\"},\"headline\":\"Azure OMS Log Analytics Step by Step \u2013 Data Collector API\",\"datePublished\":\"2018-07-20T11:56:55+00:00\",\"dateModified\":\"2018-07-21T12:45:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/azure-oms-log-analytics-step-by-step-data-collector-api\/\"},\"wordCount\":250,\"commentCount\":4,\"publisher\":{\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a\"},\"keywords\":[\"api\",\"Automation\",\"Azure\",\"Azure Automation\",\"data collector\",\"data collector api\",\"Event Log\",\"Log\",\"Log Analytics\",\"web api\"],\"articleSection\":[\"Azure\",\"PowerShell\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"http:\/\/www.ciraltos.com\/staging2\/azure-oms-log-analytics-step-by-step-data-collector-api\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/azure-oms-log-analytics-step-by-step-data-collector-api\/\",\"url\":\"http:\/\/www.ciraltos.com\/staging2\/azure-oms-log-analytics-step-by-step-data-collector-api\/\",\"name\":\"Azure OMS Log Analytics Step by Step \u2013 Data Collector API - ciraltos\",\"isPartOf\":{\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#website\"},\"datePublished\":\"2018-07-20T11:56:55+00:00\",\"dateModified\":\"2018-07-21T12:45:02+00:00\",\"description\":\"In this post and video I go over writing data directly to Log Analytics with the HTTP Data Collector API using PowerShell.\",\"breadcrumb\":{\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/azure-oms-log-analytics-step-by-step-data-collector-api\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/www.ciraltos.com\/staging2\/azure-oms-log-analytics-step-by-step-data-collector-api\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/azure-oms-log-analytics-step-by-step-data-collector-api\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/www.ciraltos.com\/staging2\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Azure OMS Log Analytics Step by Step \u2013 Data Collector API\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#website\",\"url\":\"http:\/\/www.ciraltos.com\/staging2\/\",\"name\":\"ciraltos\",\"description\":\"cloud, technology and trends\",\"publisher\":{\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/www.ciraltos.com\/staging2\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a\",\"name\":\"Travis Roberts\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2023\/03\/Logo-1.png\",\"contentUrl\":\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2023\/03\/Logo-1.png\",\"width\":5657,\"height\":3563,\"caption\":\"Travis Roberts\"},\"logo\":{\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/image\/\"},\"sameAs\":[\"http:\/\/www.ciraltos.com\",\"https:\/\/twitter.com\/ciraltos\"],\"url\":\"https:\/\/www.ciraltos.com\/staging2\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Azure OMS Log Analytics Step by Step \u2013 Data Collector API - ciraltos","description":"In this post and video I go over writing data directly to Log Analytics with the HTTP Data Collector API using PowerShell.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/www.ciraltos.com\/staging2\/azure-oms-log-analytics-step-by-step-data-collector-api\/","og_locale":"en_US","og_type":"article","og_title":"Azure OMS Log Analytics Step by Step \u2013 Data Collector API - ciraltos","og_description":"In this post and video I go over writing data directly to Log Analytics with the HTTP Data Collector API using PowerShell.","og_url":"http:\/\/www.ciraltos.com\/staging2\/azure-oms-log-analytics-step-by-step-data-collector-api\/","og_site_name":"ciraltos","article_published_time":"2018-07-20T11:56:55+00:00","article_modified_time":"2018-07-21T12:45:02+00:00","author":"Travis Roberts","twitter_card":"summary_large_image","twitter_creator":"@ciraltos","twitter_site":"@ciraltos","twitter_misc":{"Written by":"Travis Roberts","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/www.ciraltos.com\/staging2\/azure-oms-log-analytics-step-by-step-data-collector-api\/#article","isPartOf":{"@id":"http:\/\/www.ciraltos.com\/staging2\/azure-oms-log-analytics-step-by-step-data-collector-api\/"},"author":{"name":"Travis Roberts","@id":"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a"},"headline":"Azure OMS Log Analytics Step by Step \u2013 Data Collector API","datePublished":"2018-07-20T11:56:55+00:00","dateModified":"2018-07-21T12:45:02+00:00","mainEntityOfPage":{"@id":"http:\/\/www.ciraltos.com\/staging2\/azure-oms-log-analytics-step-by-step-data-collector-api\/"},"wordCount":250,"commentCount":4,"publisher":{"@id":"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a"},"keywords":["api","Automation","Azure","Azure Automation","data collector","data collector api","Event Log","Log","Log Analytics","web api"],"articleSection":["Azure","PowerShell"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["http:\/\/www.ciraltos.com\/staging2\/azure-oms-log-analytics-step-by-step-data-collector-api\/#respond"]}]},{"@type":"WebPage","@id":"http:\/\/www.ciraltos.com\/staging2\/azure-oms-log-analytics-step-by-step-data-collector-api\/","url":"http:\/\/www.ciraltos.com\/staging2\/azure-oms-log-analytics-step-by-step-data-collector-api\/","name":"Azure OMS Log Analytics Step by Step \u2013 Data Collector API - ciraltos","isPartOf":{"@id":"http:\/\/www.ciraltos.com\/staging2\/#website"},"datePublished":"2018-07-20T11:56:55+00:00","dateModified":"2018-07-21T12:45:02+00:00","description":"In this post and video I go over writing data directly to Log Analytics with the HTTP Data Collector API using PowerShell.","breadcrumb":{"@id":"http:\/\/www.ciraltos.com\/staging2\/azure-oms-log-analytics-step-by-step-data-collector-api\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/www.ciraltos.com\/staging2\/azure-oms-log-analytics-step-by-step-data-collector-api\/"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/www.ciraltos.com\/staging2\/azure-oms-log-analytics-step-by-step-data-collector-api\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/www.ciraltos.com\/staging2\/"},{"@type":"ListItem","position":2,"name":"Azure OMS Log Analytics Step by Step \u2013 Data Collector API"}]},{"@type":"WebSite","@id":"http:\/\/www.ciraltos.com\/staging2\/#website","url":"http:\/\/www.ciraltos.com\/staging2\/","name":"ciraltos","description":"cloud, technology and trends","publisher":{"@id":"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/www.ciraltos.com\/staging2\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a","name":"Travis Roberts","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/image\/","url":"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2023\/03\/Logo-1.png","contentUrl":"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2023\/03\/Logo-1.png","width":5657,"height":3563,"caption":"Travis Roberts"},"logo":{"@id":"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/image\/"},"sameAs":["http:\/\/www.ciraltos.com","https:\/\/twitter.com\/ciraltos"],"url":"https:\/\/www.ciraltos.com\/staging2\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/posts\/523"}],"collection":[{"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/comments?post=523"}],"version-history":[{"count":4,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/posts\/523\/revisions"}],"predecessor-version":[{"id":528,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/posts\/523\/revisions\/528"}],"wp:attachment":[{"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/media?parent=523"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/categories?post=523"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/tags?post=523"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}