### Quick Start Source: https://logtide.dev/docs/sdks/php A basic example demonstrating how to initialize the SDK and capture logs and exceptions. ```APIDOC ## Quick Start ```php 'https://lp_abc123@api.logtide.dev', 'service' => 'api-server', 'environment' => 'production', 'release' => '1.0.0', ]); // Capture logs info('Server started', ['port' => 8080]); error('Query timeout', ['query' => 'SELECT ...', 'duration_ms' => 5000]); // Capture exceptions try { riskyOperation(); } catch (\Throwable $e) { captureException($e); } // Shutdown is auto-handled via register_shutdown_function ``` The DSN (Data Source Name) encodes your API host and project key in a single connection string. You can find it in your LogTide project settings. ``` -------------------------------- ### Install LogTide Go SDK Source: https://logtide.dev/docs/sdks/go Install the LogTide Go SDK using the go get command. Requires Go 1.23 or later. ```bash go get github.com/logtide-dev/logtide-sdk-go ``` -------------------------------- ### Initialize LogTide Client and Send Logs Source: https://logtide.dev/docs/sdks/kotlin Quick start example demonstrating how to initialize the LogTide client with options and send basic log messages. Ensure `runBlocking` is used for suspending functions like `close()`. ```kotlin import dev.logtide.sdk.LogTideClient import dev.logtide.sdk.models.LogTideClientOptions val client = LogTideClient( LogTideClientOptions( apiUrl = "http://localhost:8080", apiKey = "lp_your_api_key_here" ) ) // Send logs client.info("api-gateway", "Server started", mapOf("port" to 3000)) client.error("database", "Connection failed", RuntimeException("Timeout")) // Graceful shutdown (also automatic on JVM shutdown) runBlocking { client.close() } ``` -------------------------------- ### Installation Source: https://logtide.dev/docs/sdks/php Instructions for installing the LogTide PHP SDK and framework-specific packages. ```APIDOC ## Installation Requires PHP 8.1 or higher. ```bash composer require logtide/logtide ``` For framework-specific integrations, install the corresponding package instead (it includes `logtide/logtide` as a dependency): ```bash # Framework packages (pick one) composer require logtide/logtide-laravel # Laravel 10/11/12 composer require logtide/logtide-symfony # Symfony 6.4/7.x composer require logtide/logtide-slim # Slim 4 composer require logtide/logtide-wordpress # WordPress ``` ``` -------------------------------- ### Quick Start Deployment with Docker Compose Source: https://logtide.dev/docs/deployment Use this command to quickly set up and start LogTide using pre-built Docker images. Ensure you edit the .env file with secure passwords before starting. ```bash # Create project directory mkdir logtide && cd logtide # Download docker-compose.yml and environment template curl -O https://raw.githubusercontent.com/logtide-dev/logtide/main/docker/docker-compose.yml curl -O https://raw.githubusercontent.com/logtide-dev/logtide/main/docker/.env.example mv .env.example .env # Edit .env with secure passwords nano .env # Start LogTide docker compose up -d ``` -------------------------------- ### Install LogTide with Docker Compose Source: https://logtide.dev/docs/getting-started Follow these steps to download configuration files, set up your .env file, and start LogTide using Docker Compose. Ensure you configure sensitive variables like DB_PASSWORD and API_KEY_SECRET. ```bash # 1. Create project directory mkdir logtide && cd logtide # 2. Download configuration files curl -O https://raw.githubusercontent.com/logtide-dev/logtide/main/docker/docker-compose.yml curl -O https://raw.githubusercontent.com/logtide-dev/logtide/main/docker/.env.example mv .env.example .env # 3. Configure your .env file (IMPORTANT!) nano .env # Required changes: # - DB_PASSWORD: set a secure password # - REDIS_PASSWORD: set a secure password # - API_KEY_SECRET: run "openssl rand -base64 32" and paste the result # - PUBLIC_API_URL: set to http://YOUR_SERVER_IP:8080 (if accessing remotely) # 4. Start LogTide docker compose up -d # 5. Access the dashboard # Frontend: http://localhost:3000 # API: http://localhost:8080 # Optional: Enable Docker log collection # Download Fluent Bit configs and restart with --profile logging # curl -O https://raw.githubusercontent.com/logtide-dev/logtide/main/docker/{fluent-bit.conf,parsers.conf,extract_container_id.lua,map_syslog_level.lua,wrap_logs.lua} # docker compose --profile logging up -d ``` -------------------------------- ### Install LogTide PHP SDK Source: https://logtide.dev/docs/sdks/php Use Composer to install the core SDK or framework-specific packages. ```bash composer require logtide/logtide ``` ```bash # Framework packages (pick one) composer require logtide/logtide-laravel # Laravel 10/11/12 composer require logtide/logtide-symfony # Symfony 6.4/7.x composer require logtide/logtide-slim # Slim 4 composer require logtide/logtide-wordpress # WordPress ``` -------------------------------- ### Install LogTide Python SDK Source: https://logtide.dev/docs/sdks/python Install the core SDK or with optional extras for async clients or specific web framework middleware. ```bash pip install logtide-sdk ``` ```bash # Async client (requires aiohttp) pip install logtide-sdk[async] # Flask middleware pip install logtide-sdk[flask] # Django middleware pip install logtide-sdk[django] # FastAPI middleware pip install logtide-sdk[fastapi] # Starlette middleware (standalone) pip install logtide-sdk[starlette] # All extras pip install logtide-sdk[async,flask,django,fastapi,starlette] ``` -------------------------------- ### Install WordPress SDK with Composer Source: https://logtide.dev/docs/sdks/wordpress Use Composer to install the LogTide WordPress SDK. This requires a Composer-based WordPress setup like Bedrock. ```bash composer require logtide/logtide-wordpress ``` -------------------------------- ### Install @logtide/browser Source: https://logtide.dev/docs/sdks/browser Install the LogTide Browser SDK using npm, pnpm, or yarn. ```bash npm install @logtide/browser # or with pnpm pnpm add @logtide/browser # or with yarn yarn add @logtide/browser ``` -------------------------------- ### Install @logtide/sveltekit Source: https://logtide.dev/docs/sdks/sveltekit Install the SvelteKit SDK package using npm. ```bash npm install @logtide/sveltekit ``` -------------------------------- ### Install Core, Browser, and CLI Packages Source: https://logtide.dev/docs/sdks/nodejs Install the core LogTide package for DSN configuration and event management, the browser package for frontend applications, and the CLI tool for source map handling. ```bash npm install @logtide/core # Browser & Frontend packages npm install @logtide/browser # CLI Tool (for source maps) npm install -g @logtide/cli ``` -------------------------------- ### Install LogTide SDK Source: https://logtide.dev/docs/sdks/nextjs-sdk Install the required package via npm. ```bash npm install @logtide/nextjs ``` -------------------------------- ### Run Hono app across different runtimes Source: https://logtide.dev/docs/sdks/hono Examples for starting the Hono application in various supported environments. ```typescript import { serve } from '@hono/node-server'; serve(app, { port: 3000 }); ``` ```typescript export default { port: 3000, fetch: app.fetch }; ``` ```typescript export default app; ``` ```typescript Deno.serve(app.fetch); ``` -------------------------------- ### Install Angular SDK Source: https://logtide.dev/docs/sdks/angular Install the @logtide/angular package using npm. ```bash npm install @logtide/angular ``` -------------------------------- ### Quick Start with LogTideClient Source: https://logtide.dev/docs/sdks/csharp Initialize the client using a DSN and perform basic logging or scoped tracing. ```csharp using LogTide.SDK.Core; using LogTide.SDK.Models; // Create client with DSN await using var client = LogTideClient.FromDsn("https://lp_your_key@api.logtide.dev"); // Send logs client.Info("api-gateway", "Server started", new() { ["port"] = 3000 }); client.Error("database", "Connection failed", new Exception("Timeout")); // Scoped tracing — all logs get the same W3C trace ID using (var scope = LogTideScope.Create()) { client.Info("api", "Request received"); client.Info("db", "Query executed"); } ``` -------------------------------- ### Install LogTide Slim SDK Source: https://logtide.dev/docs/sdks/slim Use Composer to install the LogTide SDK for Slim 4. ```bash composer require logtide/logtide-slim ``` -------------------------------- ### Manage and Verify Vector Service Source: https://logtide.dev/docs/syslog Start, enable, and check the status of the Vector service. Verify the installed Vector version. ```bash # Start Vector sudo systemctl enable vector sudo systemctl start vector # Check status sudo systemctl status vector vector --version ``` -------------------------------- ### Go SDK Example Source: https://logtide.dev/docs/error-handling Example demonstrating how to use the LogTide Go SDK to log errors, including handling wrapped errors. ```APIDOC ### Go ```go import "github.com/logtide-dev/logtide-sdk-go" client := logtide.NewClient(logtide.Config{ ApiURL: "https://logs.example.com", ApiKey: "lp_your_api_key", }) if err := riskyOperation(); err != nil { // Error is serialized with stack trace (if using pkg/errors or similar) client.Error("api", "Operation failed", logtide.WithError(err)) } // With wrapped errors if err := fetchData(); err != nil { return fmt.Errorf("failed to fetch user data: %w", err) } ``` ``` -------------------------------- ### Install LogTide Fastify plugin Source: https://logtide.dev/docs/sdks/fastify Use npm to install the package in your project. ```bash npm install @logtide/fastify ``` -------------------------------- ### Install and Start OpenTelemetry Collector Service Source: https://logtide.dev/docs/windows Use PowerShell to create and start the OpenTelemetry Collector as a Windows service. Ensure you run PowerShell as an Administrator. ```powershell # Create the Windows service sc.exe create "OpenTelemetry Collector" binPath= ""C:\Program Files\OpenTelemetry Collector\otelcol-contrib.exe" --config="C:\Program Files\OpenTelemetry Collector\config.yaml"" start= auto # Start the service sc.exe start "OpenTelemetry Collector" # Check status sc.exe query "OpenTelemetry Collector" ``` -------------------------------- ### Install @logtide/express Source: https://logtide.dev/docs/sdks/express Install the Express middleware package. This also installs @logtide/core as a dependency. ```bash npm install @logtide/express ``` -------------------------------- ### Install LogTide Hono middleware Source: https://logtide.dev/docs/sdks/hono Use npm to install the required package. ```bash npm install @logtide/hono ``` -------------------------------- ### Install LogTide SDK Packages Source: https://logtide.dev/docs/sdks/csharp Use the .NET CLI to add the core SDK or the optional Serilog integration package to your project. ```bash dotnet add package LogTide.SDK ``` ```bash dotnet add package LogTide.SDK.Serilog ``` -------------------------------- ### LDAP Configuration Examples Source: https://logtide.dev/docs/authentication JSON configuration templates for OpenLDAP and Active Directory environments. ```json { "serverUrl": "ldap://ldap.example.com:389", "bindDn": "cn=admin,dc=example,dc=com", "bindPassword": "admin-password", "searchBase": "ou=users,dc=example,dc=com", "searchFilter": "(uid={{username}})", "emailAttribute": "mail", "nameAttribute": "cn" } ``` ```json { "serverUrl": "ldaps://ad.example.com:636", "bindDn": "CN=Service Account,OU=Service Accounts,DC=example,DC=com", "bindPassword": "service-account-password", "searchBase": "OU=Users,DC=example,DC=com", "searchFilter": "(sAMAccountName={{username}})", "emailAttribute": "mail", "nameAttribute": "displayName" } ``` -------------------------------- ### Start self-hosted LogTide Source: https://logtide.dev/docs Launch the application containers using Docker Compose. ```bash docker compose up -d # Frontend: http://localhost:3000 # API: http://localhost:8080 ``` -------------------------------- ### Initialize LogTide SDK Source: https://logtide.dev/docs/sdks/php Initialize the SDK with your DSN and optional metadata to start capturing logs and exceptions. ```php 'https://lp_abc123@api.logtide.dev', 'service' => 'api-server', 'environment' => 'production', 'release' => '1.0.0', ]); // Capture logs info('Server started', ['port' => 8080]); error('Query timeout', ['query' => 'SELECT ...', 'duration_ms' => 5000]); // Capture exceptions try { riskyOperation(); } catch (\Throwable $e) { captureException($e); } // Shutdown is auto-handled via register_shutdown_function ``` -------------------------------- ### Install @logtide/elysia Source: https://logtide.dev/docs/sdks/elysia Use the Bun package manager to add the plugin to your project. ```bash bun add @logtide/elysia ``` -------------------------------- ### Download Fluent Bit Installer Source: https://logtide.dev/docs/windows Use PowerShell to download the Fluent Bit Windows installer. Adjust the version number to match the desired release. ```powershell # Download using PowerShell (adjust version as needed) $version = "3.2.2" $url = "https://packages.fluentbit.io/windows/fluent-bit-$version-win64.exe" Invoke-WebRequest -Uri $url -OutFile "fluent-bit-installer.exe" # Run installer (or use silent install) . fluent-bit-installer.exe /S ``` -------------------------------- ### VPS Deployment Configuration Source: https://logtide.dev/docs/deployment Example .env configuration for a VPS deployment where the API URL is auto-detected. ```bash # Server IP: 192.168.1.100 # .env configuration - no PUBLIC_API_URL needed! DB_PASSWORD=secure_password REDIS_PASSWORD=secure_password API_KEY_SECRET=your_32_character_secret_key_here # Access points: # Frontend: http://192.168.1.100:3000 # API: http://192.168.1.100:8080 (auto-detected) ``` -------------------------------- ### Node.js SDK Example Source: https://logtide.dev/docs/error-handling Example demonstrating how to use the LogTide Node.js SDK to log errors, including handling nested exceptions. ```APIDOC ### Node.js ```typescript import { LogTideClient } from '@logtide/sdk-node'; const client = new LogTideClient({ apiUrl: 'https://logs.example.com', apiKey: 'lp_your_api_key', // Or use a DSN string instead: // dsn: 'https://lp_your_api_key@logs.example.com', }); try { await riskyOperation(); } catch (error) { // Error is automatically serialized with stack trace client.error('api', 'Operation failed', error); } // With error.cause (Node.js 16.9+) try { await fetchData(); } catch (error) { throw new Error('Failed to fetch user data', { cause: error }); } ``` ``` -------------------------------- ### Configure Logging Profile Source: https://logtide.dev/docs/getting-started Download Fluent Bit configuration files required for the logging profile and start the service. ```bash # Download all required Fluent Bit config files curl -O https://raw.githubusercontent.com/logtide-dev/logtide/main/docker/fluent-bit.conf curl -O https://raw.githubusercontent.com/logtide-dev/logtide/main/docker/parsers.conf curl -O https://raw.githubusercontent.com/logtide-dev/logtide/main/docker/extract_container_id.lua curl -O https://raw.githubusercontent.com/logtide-dev/logtide/main/docker/map_syslog_level.lua curl -O https://raw.githubusercontent.com/logtide-dev/logtide/main/docker/wrap_logs.lua # Now start with logging profile docker compose --profile logging up -d ``` -------------------------------- ### Environment Variable Configuration Source: https://logtide.dev/docs/syslog Example setting for the API key in the .env file. ```bash FLUENT_BIT_API_KEY=lp_... ``` -------------------------------- ### Python SDK Example Source: https://logtide.dev/docs/error-handling Example demonstrating how to use the LogTide Python SDK to log errors, including handling chained exceptions. ```APIDOC ### Python ```python from logtide import LogTideClient client = LogTideClient( api_url="https://logs.example.com", api_key="lp_your_api_key" ) try: risky_operation() except Exception as e: # Exception is automatically serialized with traceback client.error("api", "Operation failed", exc=e) # With exception chaining try: fetch_data() except IOError as e: raise ValueError("Failed to fetch user data") from e ``` ``` -------------------------------- ### Install Framework-Specific Packages Source: https://logtide.dev/docs/sdks/nodejs Install the appropriate LogTide package for your specific web framework. These packages include @logtide/core as a dependency. ```bash # Framework packages (pick one) npm install @logtide/express # Express.js npm install @logtide/fastify # Fastify npm install @logtide/nextjs # Next.js npm install @logtide/nuxt # Nuxt npm install @logtide/sveltekit # SvelteKit npm install @logtide/hono # Hono npm install @logtide/angular # Angular npm install @logtide/elysia # Elysia ``` -------------------------------- ### Configure Go OpenTelemetry SDK Source: https://logtide.dev/docs/opentelemetry Setup the OTLP exporter and logger provider for Go services. ```go package main import ( "context" "log" "go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp" "go.opentelemetry.io/otel/log/global" sdklog "go.opentelemetry.io/otel/sdk/log" "go.opentelemetry.io/otel/sdk/resource" semconv "go.opentelemetry.io/otel/semconv/v1.24.0" ) func main() { ctx := context.Background() // Create the OTLP exporter // Self-hosted: your-server:8080 (with WithInsecure()) // Cloud: api.logtide.dev (HTTPS by default) exporter, err := otlploghttp.New(ctx, otlploghttp.WithEndpoint("your-server:8080"), otlploghttp.WithURLPath("/v1/otlp/logs"), otlploghttp.WithInsecure(), // Remove for HTTPS otlploghttp.WithHeaders(map[string]string{ "X-API-Key": "your-api-key-here", }), ) if err != nil { log.Fatalf("failed to create exporter: %v", err) } // Create resource res, _ := resource.New(ctx, resource.WithAttributes( semconv.ServiceName("my-go-service"), ), ) // Create logger provider provider := sdklog.NewLoggerProvider( sdklog.WithProcessor(sdklog.NewBatchProcessor(exporter)), sdklog.WithResource(res), ) defer provider.Shutdown(ctx) global.SetLoggerProvider(provider) } ``` -------------------------------- ### Install LogTide with Helm Source: https://logtide.dev/docs/deployment Installs LogTide on a Kubernetes cluster using the official Helm chart. Requires specifying database and Redis passwords. ```bash # Install LogTide helm install logtide logtide/logtide --namespace logtide --create-namespace --set timescaledb.auth.password= --set redis.auth.password= ``` -------------------------------- ### Install Logtide Symfony Bundle Source: https://logtide.dev/docs/sdks/symfony Use Composer to install the Logtide Symfony Bundle. If using Symfony Flex, it registers automatically. Otherwise, add it manually to config/bundles.php. ```bash composer require logtide/logtide-symfony ``` ```php ['all' => true], ]; ``` -------------------------------- ### Start Storage Engines with Docker Compose Source: https://logtide.dev/docs/storage-engines Use Docker Compose profiles to initialize the selected storage engine container. ```bash # In your .env STORAGE_ENGINE=clickhouse # Start with the ClickHouse profile docker compose --profile clickhouse up -d ``` ```bash # In your .env STORAGE_ENGINE=mongodb # Start with the MongoDB profile docker compose --profile mongodb up -d ``` -------------------------------- ### Start LogTide with Traefik Source: https://logtide.dev/docs/deployment Starts LogTide services using Docker Compose with Traefik for load balancing and reverse proxying. Ensure Traefik configuration files are present. ```bash docker compose -f docker-compose.yml -f docker-compose.traefik.yml up -d ``` -------------------------------- ### Upload Source Maps via CLI Source: https://logtide.dev/docs/sdks/nuxt-sdk Install the LogTide CLI and upload source maps to enable readable stack traces. ```bash # Install the CLI npm install -g @logtide/cli # Upload source maps logtide sourcemaps upload --path ./.nuxt/dist/client --release 1.0.0 --apiKey YOUR_API_KEY ``` -------------------------------- ### Configure Node.js OpenTelemetry SDK Source: https://logtide.dev/docs/opentelemetry Setup the OTLP exporter and initialize the NodeSDK to emit logs to LogTide. ```typescript import { NodeSDK } from '@opentelemetry/sdk-node'; import { OTLPLogExporter } from '@opentelemetry/exporter-logs-otlp-http'; import { BatchLogRecordProcessor } from '@opentelemetry/sdk-logs'; import { Resource } from '@opentelemetry/resources'; import { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions'; import { logs, SeverityNumber } from '@opentelemetry/api-logs'; // Configure the OTLP exporter // Self-hosted: http://your-server:8080/v1/otlp/logs // Cloud: https://api.logtide.dev/v1/otlp/logs const logExporter = new OTLPLogExporter({ url: 'http://your-server:8080/v1/otlp/logs', headers: { 'X-API-Key': 'your-api-key-here', }, }); // Initialize the SDK const sdk = new NodeSDK({ resource: new Resource({ [ATTR_SERVICE_NAME]: 'my-service', }), logRecordProcessor: new BatchLogRecordProcessor(logExporter), }); sdk.start(); // Get a logger and emit logs const logger = logs.getLogger('my-logger'); logger.emit({ severityNumber: SeverityNumber.INFO, severityText: 'INFO', body: 'User logged in successfully', attributes: { 'user.id': '12345', 'user.email': 'user@example.com', }, }); ``` -------------------------------- ### Configure self-hosted environment variables Source: https://logtide.dev/docs Set required security credentials in the .env file before starting the service. ```bash DB_PASSWORD=your_secure_db_password REDIS_PASSWORD=your_secure_redis_password # optional since v0.5.0 API_KEY_SECRET=your_32_character_secret_key_here ``` -------------------------------- ### Configure Python OpenTelemetry SDK Source: https://logtide.dev/docs/opentelemetry Setup the OTLP exporter and attach it to the standard Python logging module. ```python from opentelemetry import _logs from opentelemetry.sdk._logs import LoggerProvider, LoggingHandler from opentelemetry.sdk._logs.export import BatchLogRecordProcessor from opentelemetry.exporter.otlp.proto.http._log_exporter import OTLPLogExporter from opentelemetry.sdk.resources import Resource, SERVICE_NAME import logging # Configure the resource resource = Resource.create({ SERVICE_NAME: "my-python-service" }) # Configure the OTLP exporter # Self-hosted: http://your-server:8080/v1/otlp/logs # Cloud: https://api.logtide.dev/v1/otlp/logs exporter = OTLPLogExporter( endpoint="http://your-server:8080/v1/otlp/logs", headers={"X-API-Key": "your-api-key-here"}, ) # Set up the logger provider logger_provider = LoggerProvider(resource=resource) logger_provider.add_log_record_processor(BatchLogRecordProcessor(exporter)) _logs.set_logger_provider(logger_provider) # Attach to Python's logging module handler = LoggingHandler( level=logging.DEBUG, logger_provider=logger_provider, ) logging.getLogger().addHandler(handler) logging.getLogger().setLevel(logging.DEBUG) # Now all logs will be sent to LogTide logging.info("Application started", extra={"user.id": "12345"}) logging.warning("High memory usage", extra={"memory.percent": 85}) logging.error("Database connection failed", extra={"db.host": "localhost"}) ``` -------------------------------- ### Query Logs Source: https://logtide.dev/docs/api Examples for filtering and searching logs using query parameters. ```bash # Get all error logs curl "http://localhost:8080/api/v1/logs?level=error&limit=50" -H "X-API-Key: lp_your_api_key_here" # Filter by service and time range curl "http://localhost:8080/api/v1/logs?service=api-gateway&from=2025-01-15T00:00:00Z&to=2025-01-15T23:59:59Z" -H "X-API-Key: lp_your_api_key_here" # Full-text search curl "http://localhost:8080/api/v1/logs?q=timeout&limit=20" -H "X-API-Key: lp_your_api_key_here" ``` -------------------------------- ### View Auto-Generated Admin Credentials Source: https://logtide.dev/docs/authentication Example of the console output displayed during the first startup if no initial admin environment variables are provided. ```text ╔════════════════════════════════════════════════════════════════╗ ║ INITIAL ADMIN CREDENTIALS (save these!) ║ ╠════════════════════════════════════════════════════════════════╣ ║ Email: system@logtide.internal ║ ║ Password: xY7k2mN9pQ4rS1tU... ║ ╠════════════════════════════════════════════════════════════════╣ ║ Change your password after first login! ║ ║ Or set INITIAL_ADMIN_* env vars for future deployments. ║ ╚════════════════════════════════════════════════════════════════╝ ``` -------------------------------- ### Quick Start with LogTide Client Source: https://logtide.dev/docs/sdks/python Initialize the LogTide client with API credentials and send basic log messages. The client automatically handles graceful shutdown. ```python from logtide_sdk import LogTideClient, ClientOptions client = LogTideClient( ClientOptions( api_url='http://localhost:8080', api_key='lp_your_api_key_here', ) ) client.info('api-gateway', 'Server started', {'port': 3000}) client.error('database', 'Connection failed', Exception('Timeout')) # Graceful shutdown (also registered automatically via atexit) client.close() ``` -------------------------------- ### Configure LogTide Client Options Source: https://logtide.dev/docs/sdks/kotlin Example showing various configuration options for the LogTide client, including performance, reliability, metadata, and feature toggles. Adjust these based on your application's needs. ```kotlin val client = LogTideClient(LogTideClientOptions( // Required apiUrl = "http://localhost:8080", apiKey = "lp_your_api_key", // Optional - Performance batchSize = 100, // Max logs per batch (default: 100) flushInterval = 5.seconds, // Flush interval (default: 5s) maxBufferSize = 10000, // Max logs in buffer (default: 10000) // Optional - Reliability maxRetries = 3, // Max retry attempts (default: 3) retryDelay = 1.seconds, // Initial retry delay (default: 1s) circuitBreakerThreshold = 5, // Failures before circuit opens (default: 5) circuitBreakerTimeout = 60.seconds, // Circuit reset timeout (default: 60s) // Optional - Metadata globalMetadata = mapOf( // Added to all logs "environment" to "production", "version" to "1.0.0" ), // Optional - Features enableMetrics = true, // Enable metrics collection (default: true) debug = false // Enable debug logging (default: false) )) ``` -------------------------------- ### Basic Logging Methods Source: https://logtide.dev/docs/sdks/kotlin Demonstrates the usage of different log levels (debug, info, warn, error, critical) with optional structured metadata. Ensure the client is initialized before use. ```kotlin // Log levels: debug, info, warn, error, critical client.debug("service-name", "Debug message", mapOf("detail" to "value")) client.info("api-gateway", "Request received", mapOf("method" to "GET", "path" to "/users")) client.warn("cache", "Cache miss", mapOf("key" to "user:123")) client.error("database", "Query failed", mapOf("query" to "SELECT *")) client.critical("system", "Out of memory", mapOf("used" to "95%")) ``` -------------------------------- ### Quick Start: Initialize LogTide SDK Source: https://logtide.dev/docs/sdks/nodejs Initialize the LogTide SDK with your DSN, service name, environment, and release version. Includes basic integrations for console and global error capturing. Ensure graceful shutdown by calling hub.close() on SIGINT. ```typescript import { hub, ConsoleIntegration, GlobalErrorIntegration } from '@logtide/core'; hub.init({ dsn: 'https://lp_abc123@api.logtide.dev', service: 'api-server', environment: process.env.NODE_ENV, release: '1.0.0', integrations: [ new ConsoleIntegration(), new GlobalErrorIntegration(), ], }); // Capture logs hub.captureLog('info', 'Server started', { port: 3000 }); // Capture errors try { await riskyOperation(); } catch (error) { hub.captureError(error); } // Graceful shutdown process.on('SIGINT', async () => { await hub.close(); process.exit(0); }); ``` -------------------------------- ### LogTide Alert Rule Example Source: https://logtide.dev/docs/migration/elk Equivalent LogTide alert rule configuration for the provided Elasticsearch Watcher example. ```json { "name": "High Error Rate", "enabled": true, "level": ["error"], "threshold": 100, "timeWindow": 5, "emailRecipients": [ "admin@example.com" ] } ``` -------------------------------- ### Install rsyslog on Proxmox VE Source: https://logtide.dev/docs/syslog Installs the rsyslog package on Debian-based systems like Proxmox VE. This is a prerequisite for configuring rsyslog to forward logs. ```bash apt install rsyslog -y ``` -------------------------------- ### Elasticsearch Watcher Rule Example Source: https://logtide.dev/docs/migration/elk Example of an Elasticsearch Watcher rule configuration using a 5-minute interval and an error level query. ```json { "trigger": { "schedule": { "interval": "5m" } }, "input": { "search": { "request": { "indices": ["app-*"], "body": { "query": { "match": { "level": "error" } } } } } }, "condition": { "compare": { "ctx.payload.hits.total": { "gt": 100 } } }, "actions": { "email_admin": { "email": { "to": "admin@example.com" } } } } ``` -------------------------------- ### Configure System Metrics Source: https://logtide.dev/docs/getting-started Download required Fluent Bit configuration files and enable the metrics profile in Docker Compose. ```bash curl -O https://raw.githubusercontent.com/logtide-dev/logtide/main/docker/fluent-bit-metrics.conf curl -O https://raw.githubusercontent.com/logtide-dev/logtide/main/docker/format_metrics.lua # 3. Add your API key to .env echo "FLUENT_BIT_API_KEY=lp_your_api_key_here" >> .env # 4. Restart with both profiles enabled docker compose --profile logging --profile metrics up -d ``` -------------------------------- ### Log Structure Example Source: https://logtide.dev/docs/error-handling An example of a log entry showing how an error is automatically serialized into the `metadata.exception` field when using LogTide SDKs. ```APIDOC ## Structured Exceptions When you pass an error to the SDK's logging methods, it automatically serializes the exception into the `metadata.exception` field: ```json { "time": "2025-01-30T12:00:00Z", "service": "api", "level": "error", "message": "Request failed", "metadata": { "exception": { "type": "Error", "message": "Connection timeout", "language": "nodejs", "stacktrace": [ { "file": "/app/src/api.ts", "function": "handleRequest", "line": 42 }, { "file": "/app/src/server.ts", "function": "processRequest", "line": 128 } ], "raw": "Error: Connection timeout\n at handleRequest (/app/src/api.ts:42:15)\n..." } } } ``` ``` -------------------------------- ### Quick Start: LogTide with Slim 4 Source: https://logtide.dev/docs/sdks/slim Initialize the LogTide SDK and add its middleware to a Slim 4 application. Ensure routing middleware is added before LogTide middleware for route pattern resolution. ```php 'https://lp_abc123@api.logtide.dev', 'service' => 'slim-api', 'environment' => 'production', ]); $app = AppFactory::create(); // Add routing middleware first (required for route pattern resolution) $app->addRoutingMiddleware(); // Add LogTide middleware $app->add(new LogtideMiddleware()); // Optional: replace Slim's error middleware with LogTide's $app->add(new LogtideErrorMiddleware()); $app->get('/users/{id}', function ($request, $response, $args) { // Your route handler return $response; }); $app->run(); ``` -------------------------------- ### Initialize LogTide with Global Singleton Source: https://logtide.dev/docs/sdks/go Initialize the LogTide SDK globally using Init with ClientOptions. Ensure to defer the flush function to send remaining logs on exit. This is the recommended approach for most applications. ```go package main import ( "context" logtide "github.com/logtide-dev/logtide-sdk-go" ) func main() { flush := logtide.Init(logtide.ClientOptions{ DSN: "https://lp_your_api_key@api.logtide.dev", Service: "my-service", Environment: "production", Release: "v1.2.3", }) defer flush() ctx := context.Background() logtide.Info(ctx, "Server started", map[string]any{"port": 8080}) logtide.Error(ctx, "Connection failed", map[string]any{"host": "db.example.com"}) } ``` -------------------------------- ### Doctrine Query Breadcrumb Example Source: https://logtide.dev/docs/sdks/symfony Example of how Doctrine SQL queries are automatically recorded as breadcrumbs, including query text, parameters, and execution time. ```php 10 tags: - attack.credential_access - attack.t1110 ``` -------------------------------- ### Simplified Deployment via Docker Compose Source: https://logtide.dev/docs/deployment Use this for single-instance setups without Redis. Requires setting DB_PASSWORD and API_KEY_SECRET in the .env file. ```bash # Create project directory mkdir logtide && cd logtide # Download simplified docker-compose (no Redis) curl -O https://raw.githubusercontent.com/logtide-dev/logtide/main/docker/docker-compose.simple.yml curl -O https://raw.githubusercontent.com/logtide-dev/logtide/main/docker/.env.example mv .env.example .env # Edit .env - only DB_PASSWORD and API_KEY_SECRET required nano .env # Start LogTide (fewer containers, less memory) docker compose -f docker-compose.simple.yml up -d ``` -------------------------------- ### Enable Ingress for LogTide Helm Installation Source: https://logtide.dev/docs/deployment Installs LogTide using Helm and enables Ingress, configuring it to use Nginx and specifying the hostname and path for the frontend service. ```bash helm install logtide logtide/logtide --namespace logtide --create-namespace --set timescaledb.auth.password= --set redis.auth.password= --set ingress.enabled=true --set ingress.className=nginx --set ingress.hosts[0].host=logtide.example.com --set ingress.hosts[0].paths[0].path=/ --set ingress.hosts[0].paths[0].pathType=Prefix --set ingress.hosts[0].paths[0].service=frontend ``` -------------------------------- ### Query Logs with Options Source: https://logtide.dev/docs/sdks/python Search logs using various options like service, level, time range, and full-text search. Ensure the client is initialized before use. ```python from datetime import datetime, timedelta from logtide_sdk import QueryOptions, LogLevel result = client.query( QueryOptions( service='api-gateway', level=LogLevel.ERROR, from_time=datetime.now() - timedelta(hours=24), to_time=datetime.now(), q='timeout', # Full-text search limit=100, offset=0, ) ) print(f"Found {result.total} logs") for log in result.logs: print(log) ``` -------------------------------- ### Install Vector Observability Data Pipeline Source: https://logtide.dev/docs/syslog Install Vector on Debian/Ubuntu systems using the provided curl script or apt package manager. Vector can act as a syslog-to-HTTP bridge. ```bash # Install Vector (Debian/Ubuntu) curl --proto '=https' --tlsv1.2 -sSf https://sh.vector.dev | bash # Or via apt curl -1sLf 'https://repositories.timber.io/public/vector/cfg/setup/bash.deb.sh' | sudo bash sudo apt install vector ``` -------------------------------- ### GET /api/v1/projects/:projectId/alerts Source: https://logtide.dev/docs/api List all alert rules for a project. ```APIDOC ## GET /api/v1/projects/:projectId/alerts ### Description List all alert rules for a project. ### Method GET ### Endpoint /api/v1/projects/:projectId/alerts ### Parameters #### Path Parameters - **projectId** (string) - Required - The unique identifier of the project ``` -------------------------------- ### Deploy LogTide using Docker Compose Source: https://logtide.dev/docs/migration/signoz Clone the LogTide repository, configure the .env file, and start the services using Docker Compose. Verify the deployment by checking the health endpoint. ```bash # Clone LogTide git clone https://github.com/logtide-dev/logtide.git cd logtide/docker # Configure cp .env.example .env # Edit .env with your settings # Start docker compose up -d # Verify curl http://localhost:8080/health ``` -------------------------------- ### GET /api/v1/logs Source: https://logtide.dev/docs/api Search and filter logs with various parameters. ```APIDOC ## GET /api/v1/logs ### Description Search and filter logs with various parameters. ### Method GET ### Endpoint /api/v1/logs ### Parameters #### Query Parameters - **service** (string) - Optional - Filter by service name - **level** (string) - Optional - Filter by level (debug, info, warn, error, critical) - **from** (string) - Optional - Start time (ISO 8601) - **to** (string) - Optional - End time (ISO 8601) - **q** (string) - Optional - Full-text search on message - **limit** (number) - Optional - Results per page (default: 100, max: 1000) - **offset** (number) - Optional - Pagination offset (default: 0) ``` -------------------------------- ### Initialize LogTide with Explicit Client Source: https://logtide.dev/docs/sdks/go Create an explicit LogTide client instance using NewClient with ClientOptions. Remember to close the client when done to release resources. This provides more control over the client's lifecycle. ```go opts := logtide.NewClientOptions() opts.DSN = "https://lp_your_api_key@api.logtide.dev" opts.Service = "my-service" client, err := logtide.NewClient(opts) if err != nil { log.Fatal(err) } defer client.Close() client.Info(context.Background(), "Hello LogTide!", nil) ``` -------------------------------- ### Instrument with OpenTelemetry Source: https://logtide.dev/docs/getting-started Install and configure OpenTelemetry packages to export logs to LogTide. ```bash # Install OpenTelemetry packages (Node.js example) npm install @opentelemetry/api-logs @opentelemetry/sdk-logs \ @opentelemetry/exporter-logs-otlp-http ``` ```typescript import { logs, SeverityNumber } from '@opentelemetry/api-logs'; import { OTLPLogExporter } from '@opentelemetry/exporter-logs-otlp-http'; import { LoggerProvider, BatchLogRecordProcessor } from '@opentelemetry/sdk-logs'; // Configure exporter const exporter = new OTLPLogExporter({ url: 'https://api.logtide.dev/v1/otlp/logs', // or localhost:8080 headers: { 'X-API-Key': 'lp_your_api_key_here' }, }); // Setup provider const provider = new LoggerProvider(); provider.addLogRecordProcessor(new BatchLogRecordProcessor(exporter)); logs.setGlobalLoggerProvider(provider); // Send a log const logger = logs.getLogger('my-app'); logger.emit({ severityNumber: SeverityNumber.INFO, body: 'Hello from OpenTelemetry!', attributes: { 'user.id': '123' }, }); ``` -------------------------------- ### Enable Docker Logs and System Metrics Source: https://logtide.dev/docs/getting-started After deploying LogTide and obtaining an API key, download the necessary Fluent Bit configuration files to enable Docker log collection and system metrics. Restart LogTide with the appropriate profiles. ```bash # After LogTide is running and you have an API key: # 1. Download Fluent Bit configs for Docker log collection curl -O https://raw.githubusercontent.com/logtide-dev/logtide/main/docker/fluent-bit.conf curl -O https://raw.githubusercontent.com/logtide-dev/logtide/main/docker/parsers.conf curl -O https://raw.githubusercontent.com/logtide-dev/logtide/main/docker/extract_container_id.lua curl -O https://raw.githubusercontent.com/logtide-dev/logtide/main/docker/map_syslog_level.lua curl -O https://raw.githubusercontent.com/logtide-dev/logtide/main/docker/wrap_logs.lua ``` -------------------------------- ### Configure System Metrics Collection Source: https://logtide.dev/docs/deployment Download configuration files for system metrics collection and start LogTide with the metrics profile enabled. This allows collection of host system metrics via the OTLP endpoint. ```bash # Download metrics configuration files curl -O https://raw.githubusercontent.com/logtide-dev/logtide/main/docker/fluent-bit-metrics.conf curl -O https://raw.githubusercontent.com/logtide-dev/logtide/main/docker/format_metrics.lua # Start with metrics profile enabled docker compose --profile metrics up -d # Or combine with Docker log collection docker compose --profile logging --profile metrics up -d ``` -------------------------------- ### GET /api/v1/logs/stream Source: https://logtide.dev/docs/api Live tail logs via Server-Sent Events (SSE). ```APIDOC ## GET /api/v1/logs/stream ### Description Live tail logs via Server-Sent Events (SSE). ### Method GET ### Endpoint /api/v1/logs/stream ### Parameters #### Query Parameters - **service** (string) - Optional - Filter by service name ```