pilz2985
pilz2985

Reputation: 257

Stackdriver Logging Advanced Filter Using Current Date/Time

I am trying to create an exclusion filter which would exclude any logs older than 7 days.

It seems with timestamp, you must specify the actual date and time for this to work -- rather than use something like timezone.now() - timedelta(days=7)

Can anyone tell me if this is possible?

Upvotes: 1

Views: 2189

Answers (3)

Shraddha Jain
Shraddha Jain

Reputation: 21

Yes, I agree with @Summit, we cannot exclude the older logs that are already ingested to Stackdriver Logging.

Upvotes: 0

Summit Raj
Summit Raj

Reputation: 880

Exclusion filters do not exclude logs that are already ingested. It only excludes new logs after the exclusion is created.

Upvotes: 0

KarthickN
KarthickN

Reputation: 409

Searching by time from the filter expression is usually achieved by absolute timestamps. At present, computing relative time is not supported in advanced filter. You can determine timestamps in RFC 3339 format by using 'date' command from Linux, as per "Choose the right time period" here.

That being said, there is an internal Feature request filed for to include the relative timestamp ( e.g. "timestamp < now - 7 days" ) on the exclusion filter.

Upvotes: 2

Related Questions