All Projects → techjacker → Systemdlogger

techjacker / Systemdlogger

Licence: mit
Exports systemd logs to an external service, eg cloudwatch, elasticsearch

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Systemdlogger

Serverless Es Logs
A Serverless plugin to transport logs to ElasticSearch
Stars: ✭ 51 (-43.96%)
Mutual labels:  aws, elasticsearch, logging, logs
Terraform Modules
Reusable Terraform modules
Stars: ✭ 63 (-30.77%)
Mutual labels:  aws, elasticsearch, logging
Aws Config To Elasticsearch
Generates an AWS Config Snapshot and ingests it into ElasticSearch for further analysis using Kibana
Stars: ✭ 62 (-31.87%)
Mutual labels:  aws, elasticsearch, kibana
Elk Hole
elasticsearch, logstash and kibana configuration for pi-hole visualiziation
Stars: ✭ 136 (+49.45%)
Mutual labels:  elasticsearch, logging, kibana
Microservice Monitoring
Monitor your Spring Boot application with the Elastic Stack all around
Stars: ✭ 114 (+25.27%)
Mutual labels:  aws, elasticsearch, kibana
Json Logging Python
Python logging library to emit JSON log that can be easily indexed and searchable by logging infrastructure such as ELK, EFK, AWS Cloudwatch, GCP Stackdriver
Stars: ✭ 143 (+57.14%)
Mutual labels:  elasticsearch, logging, kibana
Logtrail
Kibana plugin to view, search & live tail log events
Stars: ✭ 1,343 (+1375.82%)
Mutual labels:  elasticsearch, logging, kibana
Docker Elastic
Deploy Elastic stack in a Docker Swarm cluster. Ship application logs and metrics using beats & GELF plugin to Elasticsearch
Stars: ✭ 202 (+121.98%)
Mutual labels:  elasticsearch, logging, kibana
Awesome Cloud Security
Curated list of awesome cloud security blogs, podcasts, standards, projects, and examples.
Stars: ✭ 98 (+7.69%)
Mutual labels:  aws, elasticsearch, logging
Terraform Aws Elasticsearch
Terraform module to provision an Elasticsearch cluster with built-in integrations with Kibana and Logstash.
Stars: ✭ 137 (+50.55%)
Mutual labels:  aws, elasticsearch, kibana
Docker monitoring logging alerting
Docker host and container monitoring, logging and alerting out of the box using cAdvisor, Prometheus, Grafana for monitoring, Elasticsearch, Kibana and Logstash for logging and elastalert and Alertmanager for alerting.
Stars: ✭ 479 (+426.37%)
Mutual labels:  elasticsearch, logs, kibana
Wp Rest Api Log
WordPress plugin for logging REST API requests and responses
Stars: ✭ 58 (-36.26%)
Mutual labels:  elasticsearch, logging
Logvac
Simple, lightweight, api-driven log aggregation service with realtime push capabilities and historical persistence.
Stars: ✭ 61 (-32.97%)
Mutual labels:  logging, logs
Pivot Kibana
Flexmonster Pivot plugin for Kibana
Stars: ✭ 58 (-36.26%)
Mutual labels:  elasticsearch, kibana
Terraform Aws S3 Log Storage
This module creates an S3 bucket suitable for receiving logs from other AWS services such as S3, CloudFront, and CloudTrail
Stars: ✭ 65 (-28.57%)
Mutual labels:  aws, logs
Docker Elk Tutorial
docker-elk-tutorial + django + logging
Stars: ✭ 69 (-24.18%)
Mutual labels:  elasticsearch, kibana
Jmeter Elasticsearch Backend Listener
JMeter plugin that lets you send sample results to an ElasticSearch engine to enable live monitoring of load tests.
Stars: ✭ 72 (-20.88%)
Mutual labels:  elasticsearch, kibana
Tf aws elasticsearch
Terraform module which creates AWS Elasticsearch resources
Stars: ✭ 73 (-19.78%)
Mutual labels:  aws, elasticsearch
Ios Sdk
AppSpector is a debugging service for mobile apps
Stars: ✭ 56 (-38.46%)
Mutual labels:  logging, logs
Elasticsearch Cli
Command line interface for ElasticSearch
Stars: ✭ 70 (-23.08%)
Mutual labels:  elasticsearch, kibana

Build Status

systemdlogger

  • Lightweight, python only, logstash alternative
  • Exports systemd journald logs to an external service, eg cloudwatch, elasticsearch
  • Use with a cron job
  • Python 3.4+

Installation

Install Dependencies

python-systemd

# Fedora/RHEL/CentOS
$ dnf install python-systemd python3-systemd

OR

# Debian/Ubuntu/Mint
$ apt-get install python-systemd python3-systemd

Install from pip

$ pip install systemdlogger


Usage

$ systemdlogger -h
usage: systemdlogger [-h] config

Exports systemd logs to different storage backends, eg
cloudwatch/elasticsearch.

positional arguments:
  config      path to config file

optional arguments:
  -h, --help  show this help message and exit

Example usage

See example config files below.

$ systemdlogger config.json

Recommended Usage - Cron Job Runing Every Minute

*/1 * * * * . /etc/webserver.env; export ENV=$NODE_ENV; /usr/local/bin/systemdlogger /path/to/config.json >/etc/logs/systemdlogger.log 2>&1


Config

Full example config that includes extra optional properties.

Example Cloudwatch Config - just required properties

{
    "systemd": {
        "unit": "webserver"
    },
    "backends": {
        "cloudwatch": {
            "log_group_name": "log_group_name",
            "log_stream_name": "log_stream_name"
        }
    }
}

Example Elasticsearch Config - just required properties

If the elasticsearch endpoint does not use port 9200 you need to explicitly state it as shown below:

{
    "systemd": {
        "unit": "webserver"
    },
    "backends": {
        "elasticsearch": {
            "doctype": "webserver",
            "hosts": ["search-applogs-blahiy7jyhmqwerfnrfg9trdz4.eu-west-1.es.amazonaws.com:80"]
        }
    }
}

Environment Variable Interpolation

Environment variables will be interpolated when the config is loaded.

$ ENV=uat FOO=bar systemdlogger config.json

// config.json
{
    "systemd": {
        "unit": "webserver"
    },
    "backends": {
        "cloudwatch": {
            "log_group_name": "$ENV-myapp",
            "log_stream_name": "$FOO-myservice"
        }
    }
}

Is loaded as:

        ...
        "cloudwatch": {
            "log_group_name": "uat-myapp",
            "log_stream_name": "bar-myservice"
        }

Cloudwatch Backend

Appends EC2 instance id to logstream name, eg:

Log Groups > webapp-uat > webapp-i-06e2a5d847e0d532f

Elasticseach Backend

Creates daily indexes for logs in logs-YYYY-MM-DD format, eg:

logs-16-08-25
logs-16-08-26

Kibana Setup

Configure Kibana index pattern:

  • Go to Kibana index settings URL eg, http://<your_elasticsearch_domain>/_plugin/kibana/#/settings/indices/?_g=()
  • Select both checkboxes.
  • Set Index pattern interval to Daily
  • Enter [logs-]YYYY-MM-DD for the index name
  • Select timestamp for the timestamp field
  • Click on Create

Kibana Index Setup


Development Setup

$ make setup
$ source env/bin/activate
$ make deps

Unit Tests

Install dependencies

$ pip install -r requirements.txt

Run Tests

$ make test


Integration Tests

Run against elasticsearch docker container.

$ docker-compose up -d
$ make test-integration
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].