Announce node-red-contrib-http-logger

@osalonga:
A new version (2.0.1) is available on Github. Similar to the http-request node, it is now possible to select the output return format (for body request and response bodies) in the config screen:

image

I have also changed the code to make sure that NodeJs works with binary data (i.e. buffer), and you can optionally select in the config screen to convert the binary data to a string or a JSON object. That way no bytes will be messed up, in case you want to keep the binary body ...

A new section (with example flow) has been added to the readme file.

Can you provide a simple example flow and explain what is going wrong. I have never used the api key before, so it would be more efficient if I don't have to digg into the details of it ...

@BartButenaers , See attached.

flow.json (2.1 KB)

@osalonga,
It would have been nice if you had added at least some information about your flow...

I have started your 'http-request' node (on older Node-RED v0.19.5), but after some time my flow aborts:

24 Apr 22:51:39 - [info] [function:setGetData] Complete
24 Apr 22:52:00 - [error] [http request:get] Error: getaddrinfo EAI_AGAIN developer.nrel.gov:443
24 Apr 22:53:10 - [info] [function:setGetData] Complete
24 Apr 22:53:30 - [red] Uncaught Exception:
24 Apr 22:53:30 - Error: getaddrinfo EAI_AGAIN developer.nrel.gov:443
    at Object._errnoException (util.js:1022:11)
    at errnoException (dns.js:55:15)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)

Don't think this is caused by my logger-node, since I haven't started it at this point yet...

Is that another issue, or is it somehow related to this test flow?

As I already mentioned above: I have no experience at all with api keys, and I have no time left to figure it out on my own...

Hello people!
I was able to use this node with urls (like @BartButenaers examples) but when I tried to use with ip directions (like 190.xxx.xxx.xxx) it didn't work.
You know if I need set something particular, or this node doesn't work without dns?

Hi Fabio,
Welcome to this forum!
Could you please give me some extra information about your issue. For example:

  • The examples from my readme page work correctly in your flow. Is that correct?
  • Can you please explain a bit more what you mean with ip directions?
  • So you call an ip address 190.xxx.xxx.xxx with the http-request node, or do you mean something else?

Hi Bart, thanks for your quickly reply! And yes... I am new in this forum and in node-red world :slight_smile:
Answering your questions:

Exactly, your examples work perfectly.
If at the http request node I put: "https://api.ipify.org?format=json", and in http logger nodes I put: "ipify" or "https", etc. It works, even if I leave the URL filter empty.
However, if at the http request node I put something like: "192.168.0.109/device", and in http logger nodes I put: "device" or "192", etc. It doesn't work, not even if I leave URL filter empty.

I suppose that http request node works only with strings.

The thing is it would be great if I could logging access to my server, but I can't assign a dns to my IP. So, your node seemed perfect but I couldn't make it work in the way that I need it.

Thanks again!

I have no explanation for that at the moment. Would have thought that this should work ...

Problem is that the http-logger node doesn't work anymore in my current setup (nodeJs version 12.18.3). Have been debugging this morning, but is like looking a needle in a haystack... Finally I found something weird in my code:

var mitm_singleton = new Mitm();

Have found at last that it seems to work again when I remove the new...
My time is up now. Will have a look at this tonight ...

1 Like

I have removed the new in my Github repository, and then it works again for me ...
You can install my version directly from Github like this (from within your Node-RED folder!!):

npm install bartbutenaers/node-red-contrib-http-logger

I have also tried it for an IP address:

  • I access some of my devices via a http request node:

    image

  • And then I start listening, with this IP address as the filter value:

    image

  • And the http-logger node shows me this output message:

But I have to admit that the whole MITM stuff is quite obscure...
If this doesn't work in your case, I have not much ideas left what is going wrong ...

Hi Bart! I had on vacations last week... and disconected of all :slight_smile: I am just catching up with all my mails.
I will try with your new version and I will tell you how it works!

We talk later :+1:

1 Like

Hi Bart!
I tell you... I installed your new version, restarted node-red and test it. Unluckly it didn't work. Even it hung the node-red. In the console It logs:
10 Sep 15:48:57 - [red] Uncaught Exception:
10 Sep 15:48:57 - Error: getaddrinfo ENOTFOUND 190.0.NNN.NNN:1883
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:66:26)

For now, these are the news. I will investigate about this exception and I will update you if I found something.

1 Like