We have updated our Terms of Service, Code of Conduct, and Addendum.

Encoded Space char as %20 on Collect URI

JH Liew
JH Liew Posts: 13
edited June 21 in Stream


Hi, I have an API endpoint which require parameter to use a time string in the format of %Y-%m-%d %H:%M, which e.g. look something like this:

https://host/api/v1.0/endpoint?start=2024-06-21 14:00&end=2024-06-21 15:00

However when I put this on the URL, it always get converted to a value of 2024-06-21%2014:00 using example above. The API endpoint is unable to accept %20 and always ended up throwing error.

Is there a way to avoid space being converted in Discover/Collect URI in REST API collector?

Comments

  • JH Liew
    JH Liew Posts: 13

    The time string were calculating using a combination of javascript functions. E.g. C.Time.strftime(Date.now()/1000, "%Y-%m-%d %H: %M)

    I have also tried escaping the space e.g. C.Time.strftime(Date.now()/1000, "%Y-%m-%d\ %H\: %M). It seems to have worked for the time colon char ':' but space consistently get converted to %20.

  • Ralph No.
    Ralph No. Posts: 8

    Hi @JH Liew

    Strange that it expects actual blanks.
    You could try disabling the "Decode URL" option in the Collector settings. ("Collector Settings" → "Optional Settings")

    "Decode URL: When toggled to No, Cribl Stream will not decode URLs before sending the HTTP request. This setting applies to collect, authentication, and pagination requests. Defaults to Yes."

  • JH Liew
    JH Liew Posts: 13

    Didn't realise there's this option. I was running older version of Cribl (due to dev environment, which we haven't update for awhile), thanks!