Giter VIP home page Giter VIP logo

loggly-sidecar's Introduction

loggly-sidecar

Sidecar container for transmitting log files to Loggly. This container is meant to be used as a side-car container in a Kubernetes Pod, in order to collect log files from its sibling containers.

Usage

Extend this image by creating your own image:

my-loggly-sidecar
    |
    +-- Dockerfile
    |
    +-- my-fluent.conf

Here's the Dockerfile:

FROM infolinks/loggly-sidecar:v3
MAINTAINER Arik Kfir <[email protected]>
COPY my-fluent.conf /fluentd/etc/conf.d/

And here's the my-fluent.conf file collecting Apache access logs:

<source>
    @type tail
    path /var/log/access_log
    pos_file /var/log/access_log.pos
    <parse>
        @type apache2
    </parse>
    tag httpd.access_log
</source>

<match httpd.access_log>
    @type loggly_buffered
    loggly_url https://logs-01.loggly.com/bulk/#{ENV['LOGGLY_TOKEN']}/tag/httpd.access_log,httpd
    buffer_type file
    buffer_path /var/log/access_log.buffer
    flush_interval 10s
</match>

Note how the loggly token is not embedded in the Fluent configuration file, but taken from the environment variable LOGGLY_TOKEN, which will be provided from the Kubernetes manifest below.

Build the image using:

docker build -t my-loggly-sidecar .

And here's an example Kubernetes deployment manifest putting it all together:

apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: my-pod
spec:
  template:
    metadata:
      labels:
        app: my-pod
    spec:
      containers:
        - name: httpd
          image: httpd
          volumeMounts:
            - name: logs
              mountPath: /var/log/httpd
        - name: loggly
          image: my-loggly-sidecar
          env:
            - name: LOGGLY_TOKEN
              value: <your_loggly_token_here>
          volumeMounts:
            - name: logs
              mountPath: /var/log/httpd
      volumes:
        - name: logs
          emptyDir: {}

Contributions

Any contribution to the project will be appreciated! Whether it's bug reports, feature requests, pull requests - all are welcome, as long as you follow our contribution guidelines for this project and our code of conduct.

loggly-sidecar's People

Contributors

arikkfir avatar

Watchers

 avatar  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.