Code Monkey home page Code Monkey logo

Comments (12)

yokawasa avatar yokawasa commented on September 26, 2024

@jahidakhtargit Could you please provide the following info:

  • Which library did you use?: Ruby, Python, or PHP library?
  • Information of your environment on which you use the library (ie, language version, OS & it version etc )

from azure-log-analytics-data-collector.

jahidakhtargit avatar jahidakhtargit commented on September 26, 2024

I am using python 3. In the below code I am getting exception:
utf8_signs = None
try:
utf8_signs = bytes(signs).encode("utf-8")
print("utf8_signs = {}".format(utf8_signs))
except Exception as e:
print("Exception occurred: {}".format(str(e)))

from azure-log-analytics-data-collector.

yokawasa avatar yokawasa commented on September 26, 2024

Thanks! I was able to reproduce the same exception . I'll fix this and get back to you short

from azure-log-analytics-data-collector.

yokawasa avatar yokawasa commented on September 26, 2024

@jahidakhtargit please install new package azure-log-analytics-data-collector-api 0.2.0

pip install azure-log-analytics-data-collector-api --upgrade

from azure-log-analytics-data-collector.

jahidakhtargit avatar jahidakhtargit commented on September 26, 2024

@yokawasa, thanks for the info. Will upgrade and let you know.

from azure-log-analytics-data-collector.

jahidakhtargit avatar jahidakhtargit commented on September 26, 2024

@yokawasa not working, same exception I'm getting

from azure-log-analytics-data-collector.

jahidakhtargit avatar jahidakhtargit commented on September 26, 2024

@yokawasa Exception in the below code, nothing to do with azure here it seems.

signs = "POST\n{}\napplication/json\nx-ms-date:{}\n/api/logs".format(str(content_length), date)
utf8_signs = None
try:
utf8_signs = bytes(signs).encode("utf-8")
print("utf8_signs = {}".format(utf8_signs))
except Exception as e:
print("Exception occurred: {}".format(str(e)))

from azure-log-analytics-data-collector.

yokawasa avatar yokawasa commented on September 26, 2024

@jahidakhtargit Please make sure if you have installed the latest package - azure-log-analytics-data-collector-api-0.2.0

$ pip install azure-log-analytics-data-collector-api --upgrade
$ pip list |grep azure-log-analytics-data-collector-api
azure-log-analytics-data-collector-api 0.2.0

Or if you're directly using source code in Github, please git clone the latest code:

As you can see, the latest __signature function in client.py is like this:

    def __signature(self, date, content_length):
        sigs= "POST\n{}\napplication/json\nx-ms-date:{}\n/api/logs".format(
                            str(content_length),date)
        utf8_sigs = sigs.encode('utf-8')
        decoded_shared_key = base64.b64decode(self.shared_key)
        hmac_sha256_sigs = hmac.new(
                decoded_shared_key, utf8_sigs,digestmod=hashlib.sha256).digest()
        encoded_hash = base64.b64encode(hmac_sha256_sigs).decode('utf-8')
        authorization = "SharedKey {}:{}".format(self.customer_id,encoded_hash)
        return authorization

Please try with the latest package or source code

from azure-log-analytics-data-collector.

jahidakhtargit avatar jahidakhtargit commented on September 26, 2024

@yokawasa, pulled the latest code. Now it's working. Thanks for the help. One more thing, Custom log is now created in my log analytics workspace, but not able to see any data. How long does it take for the data to appear in azure?

from azure-log-analytics-data-collector.

yokawasa avatar yokawasa commented on September 26, 2024

@jahidakhtargit
There are factors that affect the latency. From my experience, it's somewhere between 5min and 10min. It may be improved in the future but I don't know. The latency I mean here is the time it takes for log data to become available after it's collected.

I'm closing this issue but please feel free to re-open if you have further discussion.

from azure-log-analytics-data-collector.

jahidakhtargit avatar jahidakhtargit commented on September 26, 2024

@yokawasa, is there a way to delete the log created through code in azure?

from azure-log-analytics-data-collector.

yokawasa avatar yokawasa commented on September 26, 2024

@jahidakhtargit
I haven't tried but it seems you can delete the log with Purge API. here are references:

from azure-log-analytics-data-collector.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.