@xmorera www.xaviermorera.com
HELPING DEVELOPERS UNDERSTAND SEARCH & BIG DATA
Xavier Morera
Querying Data in Azure Data Explorer Xavier Morera HELPING - - PowerPoint PPT Presentation
Querying Data in Azure Data Explorer Xavier Morera HELPING DEVELOPERS UNDERSTAND SEARCH & BIG DATA @xmorera www.xaviermorera.com A Query Query Results Executing Queries Kusto Web UI Integration with Kusto Explorer other products
@xmorera www.xaviermorera.com
HELPING DEVELOPERS UNDERSTAND SEARCH & BIG DATA
Xavier Morera
Kusto Web UI
Integration with
Kusto Explorer
StormEvents | where StartTime > datetime(2007-02-01) | where EventType == 'Flood' and State == 'CALIFORNIA’ | project StartTime, EndTime , State , EventType | take 10;
Plain text statement Data-flow model
s h s
StormEvents | where StartTime > datetime(2007-02-01) | where EventType == 'Flood' and State == 'CALIFORNIA’ | project StartTime, EndTime , State , EventType | take 10;
StormEvents | where StartTime > datetime(2007-02-01) | where EventType == 'Flood' and State == 'CALIFORNIA’ | project StartTime, EndTime , State , EventType | take 10;
Sequence of query statements
StormEvents | where StartTime > datetime(2007-02-01) | where EventType == 'Flood' and State == 'CALIFORNIA’ | project StartTime, EndTime , State , EventType | take 10;
Sequence of query statements
StormEvents | where StartTime > datetime(2007-02-01) | where EventType == 'Flood' and State == 'CALIFORNIA’ | project StartTime, EndTime , State , EventType | take 10;
Sequence of query statements
At least one statement being a tabular expression statement
StormEvents | where StartTime > datetime(2007-02-01) | where EventType == 'Flood' and State == 'CALIFORNIA’ | project StartTime, EndTime , State , EventType | take 10;
Structure of a tabular expression statement
StormEvents | where StartTime > datetime(2007-02-01) | where EventType == 'Flood' and State == 'CALIFORNIA’ | project StartTime, EndTime , State , EventType | take 10;
Structure of a tabular expression statement
StormEvents | where StartTime > datetime(2007-02-01) | where EventType == 'Flood' and State == 'CALIFORNIA’ | project StartTime, EndTime , State , EventType | take 10;
Data flow from one tabular query operator to another Through a set of data transformation operators
Bound together by a pipe (|) delimiter
source1 | operator1 | operator2 | [renderInstruction]
StormEvents StormEvents | where notnull(State) | project EpisodeId, State, StormEvents | summarize Count=count() by State | project State, Count | sort by Count desc | take int(100), Select * FROM StormEvents SELECT EpisodeId, State FROM StormEvents WHERE State IS NOT NULL SELECT TOP 100 State, COUNT(*) as Count FROM StormEvents GROUP BY State ORDER BY Count DESC
t h s
SQL to Kusto query translation Using EXPLAIN
Data Explorer provides a help cluster
Contains sample data
No need for you to spin up a cluster to test
t h s
The help Cluster and Sample Databases
Retrieve data not in the database tables Requests to modify the state Three mechanisms to tell apart from queries
.show cluster
Control command to show cluster information
.show cluster | count
Control command to show cluster information Command can be combined with a query
commands queries table schema tables databases capacity cluster
.create table .create-merge table .rename table .drop table
Create a table in the current database
Rename And drop
t h s
Control commands
Format Data Column Related Sort / Aggregate Date / Time Filter
T T | where Predicate where search [T [T] | ] | s search ch [ki [kind=Ca CaseSens nsitivi vity] ] [i [in ( (Ta TableSources)] )] Se SearchPredic icate
Filters on a predicate Similar to SQL Searches all columns
StormEvents | search "heavy rain" StormEvents | where DamageCrops > 0
and, or, ==, !=, =~, !~, <, >...
has, !has, contains, !contains, startswith, endswith, matches... between, not-between, distinct in, !in case
Looks for a specific word Better performance Looks for any substring match
StormEvents | where EventType contains "Storm" StormEvents | where EventType has "Storm"
now
ago totimespan datetime_add, datetime_diff... dayofyear, dayofmonth, dayofweek...
range join union count dcount dcountif summarize make-series top sort by
extend project-away project
parse mv-expand lookup format_datetime format_timespan
t h s
The Basics of KQL
t h s
More KQL Operators
s h s
Bind names to expressions Name can be used
When previously defined
Improve modularity
let Name = ScalarExpression
Bind names to expressions
let Name = TabularExpression
Bind names to expressions
let Name = FunctionDefinitionExpression
Bind names to expressions
let f=(a:int, b:string) { strcat(b, ":", a) }
Bind names to expressions
Machine learning Time series analysis
Analyze time series
Native support
Enables near real-time monitoring
let min_t = toscalar(TABLE| summarize min(TIMESTAMP)); let max_t = toscalar(TABLE| summarize max(TIMESTAMP)); let dt = 1h; TABLE | make-series num=count() default=0 on TIMESTAMP in range(min_t, max_t, dt) by COLUMN | render timechart
Native series support
let min_t = datetime(2017-01-05); let max_t = datetime(2017-02-03 22:00); let dt = 2h; demo_make_series2 | make-series num=avg(num) on TimeStamp from min_t to max_t step dt by sid | where sid == 'TS1’ | extend (anomalies, score, baseline) = series_decompose_anomalies(num, 1.5, -1, 'linefit’) | render anomalychart with(anomalycolumns=anomalies, title='Web app. traffic of a month, anomalies')
Step by step
series_fir series_fit_line series_periods_detect series_fit_2lines series_iir series_periods_validate
Perform Root Cause Analysis
Three Machine Learning plugins
t h s
Advanced KQL
Query data stored outside a Kusto cluster External tables
Create external table
t h s
Querying External Tables
All data
2020 2019 2018
(.create | .alter) external table TableName ( Schema ) kind = (blob | adl) [partition by ( Partitions ) [pathformat = ( PathFormat )]] dataformat = Format ( StorageConnectionString [, ...] ) [with (PropertyName = Value , ... )]
Proxy Cluster (ADX Proxy)
Data Explorer
Create a connection from ADX Web UI
https://ade.loganalytics.io/ subscriptions/ <subscription-id>/ resourcegroups/ <resource-group-name>/ providers/ microsoft.operationalinsights/ workspaces/ <workspace-name>
https://ade.applicationinsights.io/ subscriptions/ <subscription-id>/ resourcegroups/ <resource-group-name>/ providers/ microsoft.insights/ components/ <ai-app-name>
Azure Data Explorer flow connector
Run Kusto queries and commands
Useful to send reports, notifications, control command or export/import data
Kusto Explorer
ingest from query .export
Client-side
Service-side (pull) Service-side (push)
t h s
Exporting Data
t h s
What is a query?
available at hand Query in Data Explorer
products (integrations)
t h s
KQL
Basic
column related, and format data Advanced KQL
learning