Skip to content
Roboto Studio / evidence

youtube / video

Sanity Log Analyzer - Find What's Eating Your Sanity Usage

Original source ↗

Original video

About this video

A quick walkthrough of Sanity Log Analyzer, our internal tool that turns your Sanity request logs into a usage report. It shows which queries, images and files are eating your usage.

Full transcript

Edited transcript from the original Roboto page

We built an internal tool called Sanity Log Analyzer. It gives you a log report of your Sanity usage and suggestions on where you can optimize your Sanity Studio. You'd be surprised what you find out.

We built this tool primarily for developers and larger teams, but that's not to discourage small teams. Go ahead and try it and let us know if you liked it.

So this is where you go to get your logs. You go in the user section and all the way down, then download it and wait for it to finish downloading.

One thing Mac does annoyingly is that sometimes it adds spaces. So after you've unzipped this, make sure you rename it. I'm just going to call it log.

Now we'll run this and get the log analyzer started. I'm very lazy at typing things, so I have my own shortcut. This is what you do. We get the name log.nd JSON.

Here we have our Sanity Log Analyzer. As you can see, it gives you an overall report of where you're spending your Sanity tokens the most. In our example, our settings are costing us a lot. We need to optimize this. As you go down you can see what images are costing a lot, or should I say Sanity tokens. This file needs to be optimized. It's a big chunky one.

When traffic lands, there's high traffic on this day. This is interesting. Localhost doesn't surprise me. Our developers are always on it. Interesting, it's showing the IPs as well.

You get an idea from this. Another interesting thing you can do is filter some of these. As you can see, these are filterable, and once you click on it you will get the data related to that particular category. Remember, not everything is filterable. You can't query everything. These two, for example, can't be filtered. It's just to show you. These two categories are filterable and you can click on them and look into the details below.

Read timestamped source captions

0:03Hey, how's it going?

0:04Hey, how's it going? In today's video, I'm going to talk

0:05In today's video, I'm going to talk

0:05In today's video, I'm going to talk about our own internal tool, which we

0:07about our own internal tool, which we

0:07about our own internal tool, which we call Sanity Log Analyzer.

0:10call Sanity Log Analyzer.

0:10call Sanity Log Analyzer. Um Sanity Log Analyzer essentially gives

0:12Um Sanity Log Analyzer essentially gives

0:12Um Sanity Log Analyzer essentially gives you a log report of your Sanity usage

0:15you a log report of your Sanity usage

0:15you a log report of your Sanity usage and gives you suggestion on where you

0:17and gives you suggestion on where you

0:17and gives you suggestion on where you can optimize your Sanity Studio.

0:19can optimize your Sanity Studio.

0:19can optimize your Sanity Studio. Um you'd be surprised what you find out,

0:21Um you'd be surprised what you find out,

0:21Um you'd be surprised what you find out, by the way. So, test it out.

0:24by the way. So, test it out.

0:24by the way. So, test it out. Uh we built this tool primarily for

0:26Uh we built this tool primarily for

0:26Uh we built this tool primarily for developers and larger teams, uh but this

0:28developers and larger teams, uh but this

0:28developers and larger teams, uh but this is not to discourage small teams. Go

0:30is not to discourage small teams. Go

0:30is not to discourage small teams. Go ahead and try it and let us know if you

0:32ahead and try it and let us know if you

0:32ahead and try it and let us know if you if you liked it.

0:34if you liked it.

0:34if you liked it. Okay, so this is where you will go to

0:36Okay, so this is where you will go to

0:36Okay, so this is where you will go to get your logs.

0:37get your logs.

0:37get your logs. You go in the user section and you go

0:40You go in the user section and you go

0:40You go in the user section and you go all the way down and then you download

0:41all the way down and then you download

0:41all the way down and then you download it.

0:42it.

0:42it. And then wait for it to get downloaded.

0:45And then wait for it to get downloaded.

0:45And then wait for it to get downloaded. Okay, so one thing Mac does annoyingly

0:49Okay, so one thing Mac does annoyingly

0:49Okay, so one thing Mac does annoyingly is that sometimes it adds space. So,

0:51is that sometimes it adds space. So,

0:51is that sometimes it adds space. So, make sure after you've unzipped this,

0:53make sure after you've unzipped this,

0:54make sure after you've unzipped this, you rename it.

0:55you rename it.

0:55you rename it. So, I'm just going to call it log. Okay,

0:58So, I'm just going to call it log. Okay,

0:58So, I'm just going to call it log. Okay, so now we will run this and get the log

1:01so now we will run this and get the log

1:01so now we will run this and get the log analyzer started. Also, I'm very lazy at

1:04analyzer started. Also, I'm very lazy at

1:04analyzer started. Also, I'm very lazy at typing things, so I have my own

1:05typing things, so I have my own

1:05typing things, so I have my own shortcut. Please don't judge me.

1:08shortcut. Please don't judge me.

1:08shortcut. Please don't judge me. This is what you do.

1:09This is what you do.

1:09This is what you do. And we get the name uh

1:11And we get the name uh

1:11And we get the name uh log.nd.json.

1:13log.nd.json.

1:13log.nd.json. Okay.

1:14Okay.

1:14Okay. There we go. So, here we have our Sanity

1:16There we go. So, here we have our Sanity

1:16There we go. So, here we have our Sanity Log Analyzer.

1:18Log Analyzer.

1:18Log Analyzer. Um

1:19Um

1:19Um As you can see, um it gives you an

1:21As you can see, um it gives you an

1:21As you can see, um it gives you an overall also let me pull this in light

1:23overall also let me pull this in light

1:23overall also let me pull this in light mode. It gives you an overall report of

1:26mode. It gives you an overall report of

1:26mode. It gives you an overall report of uh you know, where you're spending your

1:28uh you know, where you're spending your

1:28uh you know, where you're spending your Sanity tokens the most. So, in our

1:30Sanity tokens the most. So, in our

1:30Sanity tokens the most. So, in our example, um our settings costing us a

1:33example, um our settings costing us a

1:33example, um our settings costing us a lot of money, we need to optimize this.

1:35lot of money, we need to optimize this.

1:35lot of money, we need to optimize this. And as you go down,

1:37And as you go down,

1:37And as you go down, you can see what images are costing a

1:40you can see what images are costing a

1:40you can see what images are costing a lot of money,

1:42lot of money,

1:42lot of money, or should I say Sanity tokens, sorry.

1:44or should I say Sanity tokens, sorry.

1:44or should I say Sanity tokens, sorry. Um

1:46Um

1:46Um Again, this is this is another

1:47Again, this is this is another

1:47Again, this is this is another interesting finding. This file needs to

1:50interesting finding. This file needs to

1:50interesting finding. This file needs to be optimized.

1:51be optimized.

1:51be optimized. It's a big chunky one.

1:53It's a big chunky one.

1:53It's a big chunky one. When traffic lands, okay, some high

1:55When traffic lands, okay, some high

1:55When traffic lands, okay, some high traffic on this day.

1:57traffic on this day.

1:57traffic on this day. This is interesting. Local host, you

1:59This is interesting. Local host, you

1:59This is interesting. Local host, you know, doesn't surprise me. Our

2:01know, doesn't surprise me. Our

2:01know, doesn't surprise me. Our developers are always on it.

2:03developers are always on it.

2:03developers are always on it. Oh, interesting.

2:05Oh, interesting.

2:05Oh, interesting. Showing the IPs as well.

2:07Showing the IPs as well.

2:07Showing the IPs as well. Okay. So, you got an idea from this.

2:10Okay. So, you got an idea from this.

2:10Okay. So, you got an idea from this. Another interesting thing you can do

2:11Another interesting thing you can do

2:11Another interesting thing you can do here is you can filter some of these.

2:14here is you can filter some of these.

2:14here is you can filter some of these. So, as you can see, these are

2:16So, as you can see, these are

2:16So, as you can see, these are filterables.

2:17filterables.

2:17filterables. And once you click on it, you will get

2:19And once you click on it, you will get

2:19And once you click on it, you will get the data related to that particular

2:22the data related to that particular

2:22the data related to that particular category.

2:24category.

2:24category. Remember not everything is filterable.

2:28Remember not everything is filterable.

2:28Remember not everything is filterable. Or should I say Grok can't query

2:30Or should I say Grok can't query

2:30Or should I say Grok can't query everything. So, these two, for example,

2:33everything. So, these two, for example,

2:33everything. So, these two, for example, can't be filtered. It's just to show

2:34can't be filtered. It's just to show

2:34can't be filtered. It's just to show you.

2:35you.

2:35you. But these two categories are filterable.

2:38But these two categories are filterable.

2:38But these two categories are filterable. And you can click on them and look into

2:40And you can click on them and look into

2:40And you can click on them and look into the details below.

2:42the details below.

2:42the details below. So, I hope this gives you a little bit

2:44So, I hope this gives you a little bit

2:44So, I hope this gives you a little bit of idea as to how the Sanity Log

2:47of idea as to how the Sanity Log

2:47of idea as to how the Sanity Log Analyzer works.

2:49Analyzer works.

2:49Analyzer works. As always, if you have any questions,

2:50As always, if you have any questions,

2:50As always, if you have any questions, get in touch. And thank you so much for

2:52get in touch. And thank you so much for

2:52get in touch. And thank you so much for watching. Have a good one, guys. Bye.

Questions answered

Editorial answers from the original Roboto page.

What is Sanity Log Analyzer?

Sanity Log Analyzer is an internal tool that generates a detailed report of your Sanity usage and provides optimization suggestions for your Sanity Studio. It shows you exactly where you're spending your Sanity tokens and highlights areas where you can improve performance and efficiency.

Read the original ↗
Who should use Sanity Log Analyzer?

We built this tool primarily for developers and larger teams, but it's open to anyone. Small teams are welcome to try it out and see if it helps optimize their Sanity setup.

Read the original ↗
How do I get started with Sanity Log Analyzer?

Go to the user section in Sanity, scroll all the way down, and download your logs. After unzipping the file, rename it to something simple like 'log' to avoid issues with spaces that macOS sometimes adds. Then run the analyzer with your log file.

Read the original ↗
What information does the analyzer show me?

The analyzer gives you an overall report of where you're spending the most Sanity tokens, breaks down costs by category like settings and images, shows you traffic patterns and which days had high traffic, displays IP addresses, and helps you identify which files need optimization because they're using too many tokens.

Read the original ↗
Can I filter the data in the report?

Yes, some categories in the report are filterable. You can click on those categories to drill down and see detailed data related to that specific area. Keep in mind that not everything is filterable, as some data types can't be queried that way.

Read the original ↗
What should I look for in the log analyzer results?

Start by looking at your overall token spending and identify which areas are costing you the most. Common culprits include settings and large images. Pay attention to traffic patterns and any spikes in usage, then focus on optimizing the biggest token consumers first.

Read the original ↗
Why would I want to analyze my Sanity logs?

You'd be surprised what you find out about your Sanity usage. Analyzing your logs helps you identify hidden inefficiencies, reduce token costs, and improve your Studio's performance by understanding exactly where your resources are going.

Read the original ↗

Answers using this evidence