{"id":40718,"date":"2023-09-30T12:57:50","date_gmt":"2023-09-30T12:57:50","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=40718"},"modified":"2023-09-30T12:57:51","modified_gmt":"2023-09-30T12:57:51","slug":"dynatraces-usql-user-session-query-language-tutorial","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/dynatraces-usql-user-session-query-language-tutorial\/","title":{"rendered":"Dynatrace\u2019s USQL (User Session Query Language) Tutorial"},"content":{"rendered":"\n<p>Dynatrace USQL is a powerful query language that allows you to analyze your Dynatrace data in depth. It is a SQL-like language that can be used to query data from all of the different Dynatrace tables, including Real User Monitoring (RUM) data, synthetic monitoring data, and infrastructure monitoring data.<\/p>\n\n\n\n<p>Here are some basic tutorials for Dynatrace USQL:<\/p>\n\n\n\n<p><strong>Getting started<\/strong><\/p>\n\n\n\n<p>To get started with USQL, you will need to create a USQL script. You can do this in the Dynatrace UI or in a text editor.<\/p>\n\n\n\n<p>To create a USQL script in the Dynatrace UI:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go to&nbsp;<strong>Settings<\/strong>&nbsp;&gt;&nbsp;<strong>Monitoring<\/strong>&nbsp;&gt;&nbsp;<strong>USQL<\/strong>&nbsp;&gt;&nbsp;<strong>Create new script<\/strong>.<\/li>\n\n\n\n<li>Enter a name for your script and click&nbsp;<strong>Create<\/strong>.<\/li>\n\n\n\n<li>Paste your USQL code into the script editor.<\/li>\n\n\n\n<li>Click&nbsp;<strong>Run<\/strong>&nbsp;to execute your script.<\/li>\n<\/ol>\n\n\n\n<p>To create a USQL script in a text editor:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Create a new text file and save it with a .usql extension.<\/li>\n\n\n\n<li>Paste your USQL code into the text file.<\/li>\n\n\n\n<li>Save the text file.<\/li>\n<\/ol>\n\n\n\n<p>Once you have created your USQL script, you can run it using the Dynatrace UI or the Dynatrace CLI.<\/p>\n\n\n\n<p><strong>Running USQL scripts<\/strong><\/p>\n\n\n\n<p>To run a USQL script in the Dynatrace UI:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go to&nbsp;<strong>Settings<\/strong>&nbsp;&gt;&nbsp;<strong>Monitoring<\/strong>&nbsp;&gt;&nbsp;<strong>USQL<\/strong>&nbsp;&gt;&nbsp;<strong>My scripts<\/strong>.<\/li>\n\n\n\n<li>Click the name of the script that you want to run.<\/li>\n\n\n\n<li>Click&nbsp;<strong>Run<\/strong>.<\/li>\n<\/ol>\n\n\n\n<p>To run a USQL script using the Dynatrace CLI:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open a terminal window.<\/li>\n\n\n\n<li>Navigate to the directory where your USQL script is located.<\/li>\n\n\n\n<li>Run the following command:<\/li>\n<\/ol>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml\">dt usql <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">script_name.usql<\/span>&gt;<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<script src=\"https:\/\/gist.github.com\/devops-school\/678601546d29ebf7bd1a3092b1ebc04a.js\"><\/script>\n","protected":false},"excerpt":{"rendered":"<p>Dynatrace USQL is a powerful query language that allows you to analyze your Dynatrace data in depth. It is a SQL-like language that can be used to&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[2],"tags":[],"class_list":["post-40718","post","type-post","status-publish","format-standard","hentry","category-uncategorised"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/40718","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=40718"}],"version-history":[{"count":1,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/40718\/revisions"}],"predecessor-version":[{"id":40719,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/40718\/revisions\/40719"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=40718"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=40718"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=40718"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}