-1

I would like to set up event logging for my application. Simple information such as date (YYYYMMDD), activity and appVersion. Later I would like to query this to give me some simple information such as how many times a certain activity occurred for each month.

From what I see there are a few different types of database in Cosmos such as NoSQL and Casandra.

Which would be the most suitable to meet my simple needs?

Alan2
  • 23,493
  • 79
  • 256
  • 450

1 Answers1

1

You can use Cosmos DB SQL API for storing this data. It has rich querying capabilities and also has a great support for aggregate functions.

One thing you would need to keep in mind is your data partitioning strategy and design your container's partition key accordingly. Considering you're going to do data aggregation on a monthly basis, I would recommend creating a partition key for year and month so that data for a month (and year) stays in a single logical partition. However, please note that a logical partition can only contain 10GB data (including indexes) so you may have to rethink your partitioning strategy if you expect the data to go above 10GB.

A cheaper alternative for you would be to use Azure Table Storage however it doesn't have that rich querying capabilities and also it doesn't have aggregation capability. However with some code (running in Azure Functions), you can aggregate the data yourself.

Gaurav Mantri
  • 128,066
  • 12
  • 206
  • 241
  • Thanks, that's a very good idea to partition for year and month. – Alan2 Feb 18 '20 at 12:01
  • 1
    If this is a write-heavy application i would NOT use date-time as a partition key. The result is the current period becomes the hot partition and will only get a fraction of your throughput. There are a number of Cosmos DB docs on partition strategy. I would encourage reading these before getting too deep into your design and test as well. thanks. – Mark Brown Feb 18 '20 at 21:48