Skip to content

Removal Guide ​

This guide helps you cleanly remove Logstyx from your project. We've designed Logstyx to be easy to remove with minimal disruption to your codebase.

Before You Remove ​

Export Your Data ​

If you want to keep your historical logs, export them before uninstalling:

  1. Log in to your Logstyx dashboard
  2. Go to Project Detail → Logs tab
  3. Click Export Data
  4. Your logs will be exported as JSONL (JSON Lines) format
  5. Save the .jsonl file to your local machine

Why JSONL? Each line is a complete JSON object, making it easy to:

  • Process line-by-line for large exports
  • Import into other logging tools
  • Parse with any JSON parser

Data is Encrypted

Your MongoDB data is encrypted at rest. Direct database dumps won't be readable. Always export via the dashboard or API to get decrypted, usable logs.

Node.js Removal ​

1. Remove Auto-Instrumentation ​

If you're using the --require flag:

package.json:

json
{
  "scripts": {
    // Before
    "start": "node --require logstyx-js-node/register app.js",
    
    // After
    "start": "node app.js"
  }
}

2. Remove SDK Code ​

Before:

javascript
const logstyx = require('logstyx-js-node')({
  projectId: 'YOUR_PROJECT_ID',
  apiKey: 'YOUR_API_KEY',
  autoInstrument: true
});

const express = require('express');
const app = express();

// Your code
logstyx.info({ message: 'User logged in', userId: user.id });

After:

javascript
// Remove logstyx require

const express = require('express');
const app = express();

// Replace with console.log or your new logging solution
console.log('User logged in', { userId: user.id });

3. Uninstall Package ​

bash
npm uninstall logstyx-js-node
# or
yarn remove logstyx-js-node

4. Remove Environment Variables ​

.env:

bash
# Remove these lines
LOGSTYX_PROJECT_ID=proj_abc123
LOGSTYX_API_KEY=key_xyz789
LOGSTYX_ENDPOINT=https://logs.company.com/api/v1/logs

React Removal ​

1. Remove SDK Code ​

Before:

jsx
import useLogstyx from 'logstyx-js-react';

function App() {
  const logger = useLogstyx({
    projectId: 'your_project_id',
    endpoint: 'https://your-domain.com/api/v1/logs'
  });

  const { ErrorBoundary, Trackable } = logger;

  return (
    <ErrorBoundary logger={logger}>
      <Trackable event="click" data={{ action: 'cta-click' }}>
        <button>Get Started</button>
      </Trackable>
    </ErrorBoundary>
  );
}

After:

jsx
// Remove import

function App() {
  return (
    <button onClick={() => console.log('Button clicked')}>
      Get Started
    </button>
  );
}

2. Replace ErrorBoundary (Optional) ​

If you want to keep error boundaries, use a standard React error boundary:

jsx
import React from 'react';

class ErrorBoundary extends React.Component {
  constructor(props) {
    super(props);
    this.state = { hasError: false };
  }

  static getDerivedStateFromError(error) {
    return { hasError: true };
  }

  componentDidCatch(error, errorInfo) {
    console.error('Error caught:', error, errorInfo);
  }

  render() {
    if (this.state.hasError) {
      return <h1>Something went wrong.</h1>;
    }
    return this.props.children;
  }
}

export default ErrorBoundary;

3. Uninstall Package ​

bash
npm uninstall logstyx-js-react
# or
yarn remove logstyx-js-react

React Native Removal ​

1. Remove SDK Code ​

Before:

jsx
import logstyx from 'logstyx-js-react-native';

function App() {
  const logger = logstyx({
    projectId: 'your_project_id',
    appid: 'com.yourcompany.app'
  });

  const { ErrorBoundary, Trackable } = logger;

  return (
    <ErrorBoundary logger={logger}>
      <Trackable event="press" data={{ action: 'signup' }}>
        <TouchableOpacity>
          <Text>Get Started</Text>
        </TouchableOpacity>
      </Trackable>
    </ErrorBoundary>
  );
}

After:

jsx
function App() {
  return (
    <TouchableOpacity onPress={() => console.log('Button pressed')}>
      <Text>Get Started</Text>
    </TouchableOpacity>
  );
}

2. Uninstall Package ​

bash
npm uninstall logstyx-js-react-native
# or
yarn remove logstyx-js-react-native

Browser SDK Removal ​

1. Remove HTML Script Tags ​

Before:

html
<script>
  window.LogstyxConfig = {
    projectId: "proj_abc123",
    endpoint: "https://logs.yourcompany.com/api/v1/logs"
  };
</script>
<script src="logstyx-browser.min.js"></script>

After:

html
<!-- Remove both script tags -->

2. Remove Data Attributes ​

Before:

html
<button 
  data-logstyx-event="click"
  data-logstyx-context='{"action":"signup"}'>
  Sign Up
</button>

After:

html
<button>
  Sign Up
</button>

3. Delete SDK File ​

bash
rm public/logstyx-browser.min.js
# or wherever you stored it

Core SDK Removal ​

1. Remove SDK Code ​

Before:

javascript
const { useLogstyx } = require('logstyx-js-core');

const logger = useLogstyx({
  projectId: 'your_project_id',
  apiKey: 'your_api_key',
  signatureFunc: signatureFunc,
  sendFunc: sendFunc
});

logger.info({ message: 'Application started' });

After:

javascript
// Remove import and logger usage
console.log('Application started');

2. Uninstall Package ​

bash
npm uninstall logstyx-js-core
# or
yarn remove logstyx-js-core

Self-Hosted Infrastructure Removal ​

1. Stop Docker Containers ​

bash
cd logstyx
docker-compose down

2. Remove Volumes (Optional - deletes all data) ​

This Deletes All Data

This will permanently delete your MongoDB database and all logs. Make sure you've exported your data first!

bash
docker-compose down -v

3. Remove Installation Directory ​

bash
cd ..
rm -rf logstyx

4. Clean Up Docker Images (Optional) ​

bash
docker image prune -a

Migration to Alternative Solutions ​

Option 1: Standard Console Logging ​

Replace Logstyx with console:

javascript
// Before
logger.info({ message: 'User logged in', userId: user.id });
logger.error({ message: 'Error occurred', error: err.message });

// After
console.log('User logged in', { userId: user.id });
console.error('Error occurred', { error: err.message });

Option 2: Winston (Node.js) ​

bash
npm install winston
javascript
const winston = require('winston');

const logger = winston.createLogger({
  level: 'info',
  format: winston.format.json(),
  transports: [
    new winston.transports.File({ filename: 'error.log', level: 'error' }),
    new winston.transports.File({ filename: 'combined.log' })
  ]
});

logger.info({ message: 'User logged in', userId: user.id });

Option 3: Pino (Node.js - Faster) ​

bash
npm install pino
javascript
const pino = require('pino');
const logger = pino();

logger.info({ userId: user.id }, 'User logged in');

Option 4: Sentry (Error Tracking) ​

bash
npm install @sentry/node
javascript
const Sentry = require('@sentry/node');

Sentry.init({ dsn: 'YOUR_DSN' });

try {
  // Your code
} catch (error) {
  Sentry.captureException(error);
}

Option 5: Commercial SaaS ​

Consider these alternatives:

  • Datadog: Full observability platform
  • New Relic: APM and logging
  • Logtail: Simple log management
  • Better Stack: Modern logging platform

Verification Checklist ​

After removal, verify:

  • [ ] No logstyx imports in your codebase
  • [ ] No data-logstyx-* attributes in HTML
  • [ ] Package removed from package.json
  • [ ] Environment variables cleaned up
  • [ ] Docker containers stopped (if self-hosted)
  • [ ] Build/deploy scripts updated
  • [ ] Application runs without errors
  • [ ] Alternative logging solution in place (if needed)

Search for Remaining References ​

Use these commands to find any remaining Logstyx code:

bash
# Search for imports
grep -r "logstyx" . --exclude-dir=node_modules

# Search for data attributes
grep -r "data-logstyx" . --exclude-dir=node_modules

# Search in package files
cat package.json | grep logstyx

Need Help? ​

If you encounter issues during removal:

  1. Check our GitHub Discussions: Common removal issues and solutions
  2. File an issue: Report any removal problems
  3. Contact support: We're here to help even during offboarding

Feedback ​

We'd love to know why you're leaving. Your feedback helps us improve:

Thank you for trying Logstyx! 🙏

Released under the MIT License.