Search logs by tags using Python

It is straightforward to capture_message to sentry with tags, extras, etc. Is there a way to search previous logs by tags from Python client? I cannot find any information about that. Could you please help me?

I’m not clear what you’re asking. Any event that is tagged has the same search characteristics.

I think @xs005 is trying to query logs based on tags using the python sdk. I see the documentation about setting tags on events using the sdk but not how to query them.
Is there a way to use the python sdk to get all logs tagged “abc”, for instance?

1 Like

I am looking for something like
previous_logs = sentry_sdk.search(tag1='foo', tag2='bar')

You cannot search via our SDKs - they’re only for recording data. You will need to write your own API bindings to do that. You can query them using ‘tag:value’ in the interface (as defined in our docs). Querying the API is also fairly easy and is documented under API Reference there (and can also be introspected via your browsers developer tools to see how to form advanced API requests that the UI performs).

1 Like