-
Notifications
You must be signed in to change notification settings - Fork 48
Open
Description
I've set HTTP_PROXY, HTTPS_PROXY. I verified the connectivity using curl
in the machine which I tried this library. curl
, node's native fetch
works fine and pushes the logs. Only this library gives error with proxy. The code snippets which I tried are below,
fetch example
import proxy from "undici";
const proxyUrl = new URL("proxy url");
const agent = new proxy.ProxyAgent({
uri: proxyUrl.protocol + proxyUrl.host,
});
fetch(
"https://domain:443/services/collector/event/1.0",
{
dispatcher: agent,
method: "POST",
body: '{}',
headers: {
"Content-type": "application/json; charset=UTF-8",
authorization: "Splunk token",
},
}
)
.then((res) => {
console.log("== res", res.statusText);
})
.catch((e) => {
console.log("== err", e);
});
This is working.
splunk-logging example
import splunk from "splunk-logging";
let token = "";
let index = "";
let logger = new splunk.Logger({
port: 443,
token,
url: "",
});
logger.send(
{
message: {
message: "",
timestamp: new Date(),
},
severity: "error",
metadata: {
source: "",
sourcetype: "",
index
},
},
(error, req, res) => {
console.log(error);
console.log(res);
}
);
This throws an error ERROR: Error: connect ENETUNREACH
Metadata
Metadata
Assignees
Labels
No labels