splunk / splunk-sdk-python

Splunk Software Development Kit for Python
http://dev.splunk.com
Apache License 2.0
698 stars 370 forks source link

Splunk Message creation using in Splunk Cloud failes #574

Closed seiimonn closed 6 months ago

seiimonn commented 6 months ago

Describe the bug Creating messages in Splunk Cloud throws a key error. Tested with 9.1.2312.102. The message is created nevertheless. With Enterprise everything works as expected.

To Reproduce Steps to reproduce the behavior:

  1. Create a Message using the SDK and the create method.
service.messages.create(
            name=name,
            value=value,
            severity=severity,
            role=existing_roles,
        )

Expected behavior The created message should be returned.

Logs or Screenshots

Traceback (most recent call last):
  File "/opt/splunk/etc/apps/-/bin/../lib/splunklib/client.py", line 1376, in __getitem__
    response = self.get(key)
  File "/opt/splunk/etc/apps/-/bin/../lib/splunklib/client.py", line 1804, in get
    return super(Collection, self).get(name, owner, app, sharing, **query)
  File "/opt/splunk/etc/apps/-/bin/../lib/splunklib/client.py", line 864, in get
    **query)
  File "/opt/splunk/etc/apps/-/bin/../lib/splunklib/binding.py", line 292, in wrapper
    return request_fun(self, *args, **kwargs)
  File "/opt/splunk/etc/apps/-/bin/../lib/splunklib/binding.py", line 73, in new_f
    val = f(*args, **kwargs)
  File "/opt/splunk/etc/apps/-/bin/../lib/splunklib/binding.py", line 699, in get
    response = self.http.get(path, all_headers, **query)
  File "/opt/splunk/etc/apps/-/bin/../lib/splunklib/binding.py", line 1232, in get
    return self.request(url, { 'method': "GET", 'headers': headers })
  File "/opt/splunk/etc/apps/-/bin/../lib/splunklib/binding.py", line 1304, in request
    raise HTTPError(response)
splunklib.binding.HTTPError: HTTP 404 Not Found -- Could not find object id=redacted

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/splunk/etc/apps/-/bin/redacted.py", line 113, in stream_events
    severity="error",
  File "/opt/splunk/etc/apps/-/bin/../lib/redacted.py", line 202, in send_message
    role=existing_roles,
  File "/opt/splunk/etc/apps/-/bin/../lib/splunklib/client.py", line 1705, in create
    return self[name]
  File "/opt/splunk/etc/apps/-/bin/../lib/splunklib/client.py", line 1386, in __getitem__
    raise KeyError(key)
KeyError: UrlEncoded('redacted')

Splunk (please complete the following information):

SDK (please complete the following information):

Additional context Add any other context about the problem here.

seiimonn commented 6 months ago

Identified issue with help of support, works as expected.