Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging: Can't retrieve the writerIdentity for a logging sink #4703

Closed
jceresini opened this issue Jan 5, 2018 · 3 comments
Closed

Logging: Can't retrieve the writerIdentity for a logging sink #4703

jceresini opened this issue Jan 5, 2018 · 3 comments
Assignees
Labels
api: logging Issues related to the Cloud Logging API. priority: p2 Moderately-important priority. Fix may not be included in next release.

Comments

@jceresini
Copy link

In #4578 , support was added for creating a sink with a unique writerIdentity. It would appear that only the uniqueWriterIdentity boolean for logging.sinks.create was implemented; but retrieving the writerIdentity for an existing sink is not possible.

API response (via gcloud)

$ gcloud logging sinks list --project xxxx --log-http
[...]
-- body start --
{
  "sinks": [
    {
      "name": "xxxx",
      "destination": "storage.googleapis.com/xxxx",
      "filter": "xxxx",
      "outputVersionFormt": "V2",
      "writerIdentity": "serviceAccount:xxxx@logging-xxxx.iam.gserviceaccount.com"
    }
  ]
}

-- body end --

Simplified example code

from google.cloud import logging

logging_client = logging.Client(project_id)
sink = logging_client.sink(sink_name)
sink.reload()

Resulting object

(Pdb) sink.
sink.__class__(         sink.__hash__(          sink.__setattr__(       sink.destination
sink.__delattr__(       sink.__init__(          sink.__sizeof__(        sink.exists(
sink.__dict__           sink.__le__(            sink.__str__(           sink.filter_
sink.__dir__(           sink.__lt__(            sink.__subclasshook__(  sink.from_api_repr(
sink.__doc__            sink.__module__         sink.__weakref__        sink.full_name
sink.__eq__(            sink.__ne__(            sink._client            sink.name
sink.__format__(        sink.__new__(           sink._require_client(   sink.path
sink.__ge__(            sink.__reduce__(        sink.client             sink.project
sink.__getattribute__(  sink.__reduce_ex__(     sink.create(            sink.reload(
sink.__gt__(            sink.__repr__(          sink.delete(            sink.update(

(Pdb) sink.__dict__
{'destination': 'storage.googleapis.com/logs-00006913-fake-customer', '_client': <google.cloud.logging.client.Client object at 0x7f1d2728e860>, 'name': 'asdf1234', 'filter_': '*'}
@tseaver tseaver added api: logging Issues related to the Cloud Logging API. priority: p2 Moderately-important priority. Fix may not be included in next release. labels Jan 5, 2018
@tseaver
Copy link
Contributor

tseaver commented Jan 5, 2018

FWIW, this is another case where the back-end has smuggled in new features without changing the API version.

Also, #4595 made the unique_writer_id a constructor parameter, passing the captured attribute to Sink.create, but as a query parameter for both Sink.create and Sink.update, ISTM that it would be better passed directly to our create and update wrapper methods (we currently don't support it for Sink.update).

@dhermes
Copy link
Contributor

dhermes commented Jan 5, 2018

SGTM

@tseaver
Copy link
Contributor

tseaver commented Jan 5, 2018

For the record, PRs #4706, #4707, and #4708 finish fleshing out support for the uniqueWriterIdentity query parameter and the server-set writerIdentity property.

plamut pushed a commit to googleapis/python-logging that referenced this issue Feb 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: logging Issues related to the Cloud Logging API. priority: p2 Moderately-important priority. Fix may not be included in next release.
Projects
None yet
Development

No branches or pull requests

3 participants