Azure

Azure Log Analytics – Kusto Question – Get Knowledge For Final 20 Days

In continuation of my earlier submit on Get Min/Max from every Class, let’s do one of the vital widespread queries with filter standards for date time area.

 

For the aim of simplicity and with a purpose to hold this text extra centered, I’ve eliminated knowledge from all the extra columns as proven under,

 

GenerationDate

DescriptionTitle

DescriptionDetail

FeedKey

2020-10-02 00:00:00:0000000

2020-10-21 00:00:00:0000000

2020-10-21 00:00:00:0000000

2020-10-21 00:00:00:0000000

2020-10-21 00:00:00:0000000

2020-10-22 00:00:00:0000000

2020-10-22 00:00:00:0000000

 

Question description

 

The concept is to fetch all of the information, which occurred up to now 20 days of Technology Date.

 

Clarification

 

Now to attain our anticipated outcome, there could possibly be multiple manner.

 

Strategy 1

 

Discover out the date which falls precisely 20 days again utilizing in the past(…) after which use conditional operator (<= and >=) to attain this outcome.

 

The above method would work completely however the issue with this method is there are a lot of traces of code and calculation.

 

Strategy 2

 

Utilizing the between(…). This method may have  fewer traces of code.

  1. DemoData     
  2. the place  (todatetime(GenerationDate) – now()) between(0d…20d);   

NOTE

Make certain to do the correct datetime solid, in any other case  you might find yourself getting an error ‘Arithmetic expression can’t be carried-out between StringBuffer and DateTime’.

 

Blissful Kustoing!

Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button