Security

How to use Splunk & NodeJS to establish a connection and pull data from Splunk?

gregory__
Engager

Hi,

My team and I are currently developing a website which needs to pull data from Splunk and insert it into visualizations on the home page on the website. As the title suggests, we are currently using React and NodeJS and due to our absolute lack of Splunk experience we are a bit bogged down so please forgive me if this is a potentially dumb question. 

We are trying to use the Splunk JavaScript SDK in Node to establish a connection and pull data from Splunk. we have tried absolutely everything  at this point but cannot establish a connection and perform a simple service.login through the SDK. We have tried this with postman and it appears to be working just fine on that side of things.

For Example: 

We have tried using the code from Server Side Javascript but when running it, it throws the following error:

 

 

 

 

  throw err;
        ^
{
  response: { headers: {}, statusCode: 600 },
  status: 600,
  data: undefined,
  error: Error: connect ECONNREFUSED ::1:8089
      at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1195:16) {
    errno: -4078,
    code: 'ECONNREFUSED',
    syscall: 'connect',
    address: '::1',
    port: 8089
  }
}

Node.js v17.9.0

 

 

 

 

 

 

 

 OR this error

 

 

 

 

 

 

 

        throw err;
        ^
{
  response: { headers: {}, statusCode: 600 },
  status: 600,
  data: undefined,
  error: Error: write EPROTO 04490000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:c:\ws\deps\openssl\openssl\ssl\record\ssl3_record.c:355:

      at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:94:16) {
    errno: -4046,
    code: 'EPROTO',
    syscall: 'write'
  }
}

Node.js v17.9.0

 

 

 

 

 

 

 

 

Can anyone please help? Any help would be greatly appreciated

Labels (1)
0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@gregory__ 

In this kind of use case I would like to suggest my favourite architecture.

Please go through below pic and let me know if you need more of this.

Screenshot 2022-06-13 at 6.51.26 PM.png

Thanks
KV


If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.

 

 

Get Updates on the Splunk Community!

Ready, Set, SOAR: How Utility Apps Can Up Level Your Playbooks!

 WATCH NOW Powering your capabilities has never been so easy with ready-made Splunk® SOAR Utility Apps. Parse ...

DevSecOps: Why You Should Care and How To Get Started

 WATCH NOW In this Tech Talk we will talk about what people mean by DevSecOps and deep dive into the different ...

Introducing Ingest Actions: Filter, Mask, Route, Repeat

WATCH NOW Ingest Actions (IA) is the best new way to easily filter, mask and route your data in Splunk® ...