Send your logs and traces to Elasticsearch in seconds!
Explore the docs »
Sidekick Home
·
Report Bug & Request Feature
Table of Contents
Sidekick is a production debugging and on-demand logging tool where you can debug your running applications while they keep on running. Sidekick provides the ability to add logs and put non-breaking breakpoints in your application code which captures the snapshot of the application state, the call stack, variables, etc.
Sidekick Actions:
- A tracepoint is basically a non-breaking remote breakpoint. In short, it takes a screenshot of the variables when the code hits that line.
- Logpoints open the way for dynamic logging to Sidekick users. Replacing traditional logging with dynamic logging has the potential to lower stage sizes, costs, and time for log searching while adding the ability to add new logpoints without editing the source code, redeploying or restarting the application
This recipe aims to help you send your collected tracepoint & logpoint events to your own Elasticsearch instances.
tested with node v16.14.2
- npm
npm install npm@latest -g
- Clone the repo
npm i sidekick-client
- Install NPM packages
npm install
You can use sidekick client with any db integration, here is a elasticsearch integration example:
-
Edit
config.json
according to your needs"elasticsearch-url": "<>", "elasticsearch-apikey": "<>", "sidekick_token": "", "sidekick_tracepoint_index": "sidekick_tracepoint", "sidekick_logpoint_index": "sidekick_logpoint", "sidekick_email":"<>", "sidekick_password":"<>",
-
Create an
ingest
function with using elasticsearch client:const client = new Client({ node: config['elasticsearch-url'], auth: { apiKey: config['elasticsearch-apikey'] } }) function ingestFunc (index) { return async function (data) { client.index({ index: index, document: data.frames[0].variables }).then((res)=>{ console.log("Items saved: \n",res) }) } }
-
Call sidekickconnect function with proper parameters.
const { sidekickConnect } = require('sidekickingesterbeta') const sidekickClient = { sidekick_host : config['sidekick_host'], sidekick_port : config['sidekick_port'], sidekick_token : config['sidekick_token'], sidekick_email : config['sidekick_email'], sidekick_password : config['sidekick_password'], tracepointFunction : ingestFunc(config['sidekick_tracepoint_index']), logpointFunction : ingestFunc(config['sidekick_logpoint_index']), stdout : true //console log } sidekickConnect(sidekickClient); ```
-
Run!
npm start
You can also run this recipe in a container. For this purpose a Dockerfile is located in the directory.
- Add Tracepoint Support
- Add Logpoint Support
- Add Logpoint Detail setting
- Filter Logpoints
- Filter Tracepoints
Barış Kaya - @boroskoyo
Sidekick: website