Git Product home page Git Product logo

logproxy's Introduction

Logproxy

Build Status

A microservice which acts as a logdrain and forwards messages to HSDP Foundation logging. Supports the new HSDP v2 single tenant solution.

Features

  • Supports v2 of the HSDP logging API
  • Batch uploads messages (max 25) for good performance
  • Very lean (64MB RAM)

Dependencies

A RabbitMQ instance is required. This is used to handle spikes in log volume.

Environment variables

Variable Description Required
TOKEN Token to use as part of logdrain URL Yes
HSDP_LOGINGESTOR_KEY HSDP logging service Key Yes
HSDP_LOGINGESTOR_SECRET HSDP logging service Secret Yes
HSDP_LOGINGESTOR_URL HSPD logging service endpoint Yes
HSDP_LOGINGESTOR_PRODUCT_KEY Product key for v2 logging Yes

Building

Requirements

Compiling

Clone the repo somewhere (preferably outside your GOPATH):

$ git clone https://github.com/philips-software/logproxy.git
$ cd logproxy
$ ./buildscript.sh

This produce a logproxy binary executable in the build directory ready for use. The output also contains the unit test coverage, unit test results and a JUnit compatible format of the unit test execution result.

Docker

Alternatively, you can use the included Dockerfile to build a docker image which can be deployed to CF directly.

$ git clone https://github.com/philips-software/logproxy.git
$ cd logproxy
$ docker build -t build -f Dockerfile.build .
$ docker run --name build --rm -v `pwd`:/src build
$ docker build -t logproxy -f Dockerfile.dist .

Installation

See the below manifest.yml file as an example. Make sure you include the logproxy binary in the same folder as your manifest.yml. Also ensure the logproxy binary has executable privileges. (you can use the chmod a+x logproxy command on Linux based shells to achieve the result)

applications:
- name: logproxy
  domain: your-domain.com
  instances: 2
  memory: 128M
  disk_quota: 128M
  routes:
  - route: logproxy.your-domain.com
  buildpack: binary_buildpack
  env:
    HSDP_LOGINGESTOR_KEY: SomeKey
    HSDP_LOGINGESTOR_SECRET: SomeSecret
    HSDP_LOGINGESTOR_URL: https://logingestor-int2.us-east.philips-healthsuite.com
    HSDP_LOGINGESTOR_PRODUCT_KEY: product-uuid-here
    TOKEN: RandomTokenHere
  services:
  - rabbitmq
  stack: cflinuxfs3

A Procfile is required as well:

web: logproxy

Now push the application:

cf push

If everything went OK logproxy should now be reachable on https://logproxy.your-domain.com . The logdrain endpoint would then be:

https://logproxy.your-domain.com/syslog/drain/RandomTokenHere

Configure logdrains

In each space where you have apps running for which you'd like to drain logs define a user defined service called logproxy:

cf cups logproxy -l https://logproxy.your-domain.com/syslog/drain/RandomTokenHere

Then, bind this service to any app which should deliver their logs:

cf bind-service some-app logproxy

and restart the app to activate the logdrain:

cf restart some-app

Logs should now start flowing from your app all the way to HSDP logging infra through lgoproxy. You can use Kibana for log searching.

TODO

  • Better handling of HTTP 635 errors
  • Retry mechanism in case of POST failures

logproxy's People

Contributors

loafoe avatar krmeda avatar ivd-git avatar dependabot-preview[bot] avatar

Watchers

 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.