How to get the counts of logs per day in a week through the logging or monitoring API?

2,131 views
Skip to first unread message

dave l

unread,
Dec 15, 2021, 9:24:51 PM12/15/21
to Google Stackdriver Discussion Forum
My logs are stored in Google cloud logging. I need to record the exact number of daily logs under specified conditions, generate a line graph, and apply to my website.
How can I do this?

Philip O'Toole

unread,
Dec 15, 2021, 9:47:15 PM12/15/21
to dave l, Google Stackdriver Discussion Forum
Have you read about logs-based metrics? 

Log-based metrics are based on the content of log entries. For example, the metrics can record the number of log entries containing particular messages, or they can extract latency information reported in log entries. You can use log-based metrics in Cloud Monitoring charts and alerting policies.

Philip

On Wed, Dec 15, 2021 at 9:25 PM dave l <solol...@163.com> wrote:
My logs are stored in Google cloud logging. I need to record the exact number of daily logs under specified conditions, generate a line graph, and apply to my website.
How can I do this?

--
© 2021 Google Inc. 1600 Amphitheatre Parkway, Mountain View, CA 94043
 
Email preferences: You received this email because you signed up for the Google Stackdriver Discussion Google Group (google-stackdr...@googlegroups.com) to participate in discussions with other members of the GoogleStackdriver community.
---
You received this message because you are subscribed to the Google Groups "Google Stackdriver Discussion Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-stackdriver-d...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-stackdriver-discussion/d7a9c97a-49c6-416c-939e-ac9b0bbbd0f2n%40googlegroups.com.

刘先生

unread,
Dec 15, 2021, 10:59:04 PM12/15/21
to oto...@google.com, google-stackdr...@googlegroups.com
Yes ,I have.
This is the line chart I tried to generate in metrics explorer, but I can't understand it.

Below is my log records:

As you can see, the number of logs yesterday was 7,but it seems that there is no way to show it in the line chart,is my setting wrong?
Thanks reply.

sum...@google.com

unread,
Dec 15, 2021, 11:28:05 PM12/15/21
to Google Stackdriver Discussion Forum
Can you try using the "Stacked Bar Chart' option instead of a Line Chart? You can use a 1 week interval to see the sum of counts for each day. Let us know if that works for you.

Best Regards,
Summit

dave l

unread,
Dec 16, 2021, 8:45:06 PM12/16/21
to Google Stackdriver Discussion Forum
Below is the stacked bar chart, but the data doesn't seem to be right:
DAE81FAE-5550-4F05-B40A-40DD6A00A634.png

Reply all
Reply to author
Forward
0 new messages