7

In Google Cloud Logging, using advanced search Can we search for a text and then see logs present after and before that particular text?

Like for example in a PDF, doc or any file when you search for a word then after searching that word you can see content just above and below of the searched text, but in google cloud logging we can only see texts where words are present, but not the content present just above and below it.

Can anyone please tell me is it possible to search just above and below logs present in Google Cloud Logging or not?

Kirk Kelsey
  • 4,259
  • 1
  • 23
  • 26
Sudhanshu Gaur
  • 7,486
  • 9
  • 47
  • 94

2 Answers2

9

You can do this by pinning the log entry: https://cloud.google.com/logging/docs/view/overview#pin

Once the entry is pinned, you can relax the filter to match whatever other entries would be helpful for context.

Kirk Kelsey
  • 4,259
  • 1
  • 23
  • 26
1

There's no built in feature in Google Cloud Logging like the one you are describing.

However, what you can do with advanced filters is searching by time. This way you can search for a text and then, based on the timestampof that log, search with timeframe filter.

For example, the text log has a timestamp of 2016-11-29T23:00:00Z. Now you can search for it's context with a filter that has an upper and lower time limit from that timestamp, like this one:

timestamp >= "2016-11-29T22:55:00Z"
timestamp <= "2016-11-29T23:05:00Z"

If this workaround is not enough, then feel free to create a new feature request in Google's Issue Tracker explaining in more detail the kind of feature you would want to see introduced in Google Cloud Logging.

Guillermo Cacheda
  • 2,162
  • 14
  • 23
  • So first I have to search for the text and then again search with timestamp :(, there must have been any easy workaround, not something expected from google team :(, thanks anyways. – Sudhanshu Gaur Dec 23 '18 at 15:33