惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The Cloudflare Blog
L
LangChain Blog
WordPress大学
WordPress大学
V
V2EX
M
MIT News - Artificial intelligence
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Stack Overflow Blog
Stack Overflow Blog
J
Java Code Geeks
F
Fortinet All Blogs
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
腾讯CDC
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
D
Docker
Recent Announcements
Recent Announcements
GbyAI
GbyAI
博客园 - 叶小钗
小众软件
小众软件
Hugging Face - Blog
Hugging Face - Blog
T
The Blog of Author Tim Ferriss
人人都是产品经理
人人都是产品经理
Engineering at Meta
Engineering at Meta
Y
Y Combinator Blog
雷峰网
雷峰网
The GitHub Blog
The GitHub Blog

jdhao's digital space

Conversion between base64 and OpenCV or PIL Image 腾讯云对象存储博客图床开启 CDN 加速(不需要购买额外域名) Search and Replace in Multiple Files in Vim/Neovim Change Table Column Width in LaTeX Image or Table Side by Side in LaTeX LaTeX 并排显示图像或表格 Firenvim: Neovim inside Your Browser Content inside HTML tags missing in Latest Hugo? Creating Markdown Front Matter with Ultisnips Labelme JSON 标注格式转 voc XML 格式 Nifty Nvim Techniques That Make My Life Easier -- Series 6 macOS 下如何为视频制作字幕 Running Command Asynchronously inside Neovim Resolving Merge Conflict after Git Stash Pop Pylint: command not found? A Hands-on Experience with Neovim's Built-in LSP Support How to Convert PDF to Images with Imagemagick 互联网上常用缩略语集锦 File Backup in Neovim Converting PDF Pages to Images with Poppler Nifty Nvim Techniques That Make My Life Easier -- Series 5 Neovim Configuration for System-wide Use How to sort a list of tuple or list in Python -- lambda or itemgetter? Building A Vim Statusline from Scratch 人类第一颗原子弹爆炸始末 Distributed Training in PyTorch with Horovod Learning Expect Programming Essential Knowledge about SSH Nifty LaTeX Techniques -- Series 1 更改 Adsense 邮寄地址,重新寄送 PIN
Notes on Using GCP Logging
2024-09-17 · via jdhao's digital space

Use the SEARCH() function with care#

In the GCP Log Explorer, if you type some thing in the search bar without quote, the SEARCH() method is used.

The SEARCH() function is case insensitive. Note also that SEARCH() function uses text analyzer to tokenize the string. The SEARCH() function performs exact matches, not partial matching. So SEARCH("world") will not be able to match worldwide. Another example, suppose in some of the log entries, you may have “today is 202408180429”, if you use SEARCH("20240818"), you will find nothing matching, which you may not expect.

contain, regex match, regex unmatch#

The following operators are very useful when searching for patterns/strings

  • :: contains
  • ~=: regex match
  • !~: regex unmatch

For example,

  • textPayload =~ '.*foo.*': check if textPayload contains foo somewhere
  • textPayload !~ '.*foo.*': check if textPayload does not contain foo somewhere
  • textPayload:'foo': check if textPayload contains foo somewhere

The syntax used for the regex is RE2 syntax.

ref:

log retention period#

In GCP console, you can search for “log storage”, there are different log buckets. For each bucket, you can see their retention period, which may differ from bucket to bucket.

You can configure custom retention period if you want: https://cloud.google.com/logging/docs/buckets#custom-retention.

ref:

how to see logs around a log entry#

Sometimes we may be interested the context for a certain log entry, i.e., what happens before and after the logging entry. We can do this in two ways.

  1. We can manually specify the time interval using the timestamp field. See official doc on how to do it. You can also do it in the query editing UI by selecting the time interval.

  2. We can also pin the message we are interested first. This message will show in the timeline histogram. Then we refine the query filter and click the pin message. The context menu shows and choose Zoom to log entry. You can do this multiple times to make the time interval to be more precise.

ref: