Git Product home page Git Product logo

logstashapi's Introduction

Logstash Configuration API Server

screenshot1.png

Overview

Part of this api server code was generated by the swagger-codegen project. By using the OpenAPI-Spec from a remote server, you can easily generate a server stub.

This code allows configure logstash via RESTful API.This is useful in cloud environments as k8s where is difficult send configuration files. Use Swagger UI to retreive all endpoints. Currently this api supports multiple-pipelines and patterns configuration.

To perform configuration operations AUTH_BASIC is required. Default credentials are elastic/changeme but can be overwritten setting ELASTIC_USERNAME & ELASTIC_PASSWORD ENV variables visibles to api server process.

Running the server

To run the server, run:

npm start

To view the Swagger UI interface:

open http://localhost:8080/docs

This project leverages the mega-awesome swagger-tools middleware which does most all the work.

Testing api with standalone Logstash installation

  • Download logstash from elastic website
  • Set LOGSTASH_CONFIG_PATH ENV variable visible to logstash process & pointing to logstash main config dir (default /usr/share/logstash/config)
  • Optional: change default credentials (elastic/changeme) setting following ENV variables:
    • ELASTIC_USERNAME
    • ELASTIC_PASSWORD
  • API process needs this folders inside logstash config dir to run properly:
    • patterns : for patterns files
    • pipeline : for pipelines conf.
  • Start logstash process with auto reloading config feature (--config.reload.automatic)
  • Start api process npm start from main folder of this project.
  • Test api via Swagger UI. Remember set credentials in Swagger UI, otherwise api returns 400 code.

Testing logstash api with docker

  • run command docker build --tag api-logstash . from root folder of this project
  • run docker-compose up command from docker-compose folder inside examples folder.
  • Test api via Swagger UI. Remember set credentials in Swagger UI, otherwise api returns 400 code.Default credentials are elastic/changeme. You can overwrite default credentials setting ELASTIC_USERNAME & ELASTIC_PASSWORD env variables with desired values.

Testing logstash api with minikube

You can deploy logstash configuration api as sidecar pattern or singular statefulset, sharing the configuration persistent volume claim with Logstash Pod. For more information you can review k8s doc

For simplicity we provide a Logstash chart in this example. [helm][https://helm.sh/] is required to test this sample in minikube or k8s.

  • run make commmand inside examples/minikube folder to install logstash & configuration api in sidecar pattern mode.
  • logstash configuration api is accesible from ls-dev-logstashapi01-svc nodeport service. You can retreive url executing sudo minikube service ls-dev-logstashapi01-svc --url command. this service nodeport exposes by default 9500 (logstash config api port) and 9600 (native logstash api stat port) ports.
  • by default we use storageClass "standard" for Dynamic provision storage. You can change this default value setting custom chart values file:
config:
  dynamicProvision: true
  accessModes: [ "ReadWriteMany" ]
  storageClassName: "standard"
  resources:
    request:
      storage: 1Mi

to apply cutom configuration execute helm upgrade --wait --timeout=600 --install --values your_values_file.yml charts/logstash-1.0.0.tgz from examples/minikube folder.

Uninstall process: run make purge from examples/minikube dashboard.

logstashapi's People

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.