Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/orsinium-labs/python-syslog-logstash

Python Logger + RSysLog + Logstash. Demo over docker containers.
https://github.com/orsinium-labs/python-syslog-logstash

django docker docker-compose elasticsearch elk kibana logging logstash python redis rsyslog syslog

Last synced: about 4 hours ago
JSON representation

Python Logger + RSysLog + Logstash. Demo over docker containers.

Awesome Lists containing this project

README

        

# Python Syslog Logstash

Demonstration of logging system for Python projects. Fast and safe logs collecting.

## Scheme

1. **Python project** -- sent logs.
1. **Rsyslog** -- collect logs from projects (can be many rsyslogs on many servers).
1. **Redis** -- message queue between rsyslog and logstash.
1. **Logstash** -- retrieve data from Redis, select index and add into ElasticSearch.
1. **ElasticSearch** -- logs storage.
1. **Kibana** -- web-interface.

## Usage

1. Run:
```bash
sudo docker-compose up
```
1. Open Kibana: [127.0.0.1:5601/app/kibana](http://127.0.0.1:5601/app/kibana)
1. Go to Management -> Index patterns.
1. Click on "refresh fields". If "create" button still inactive then wait while ElasticSearch is ran.
1. Click "create"
1. Go to "Discover". This is your data :)

If you want to see indices then go to "Dev Tools" section and run this command:

```http
GET /_cat/indices
```

## Example

Example of one log message from ElasticSearch:

```json
{
"@timestamp": "2018-04-27T12:18:39.199Z",
"@version": "1",
"message": {
"name": "app_name",
"module": "app",
"lineno": 79,
"message": null,
"random_string": "ydrvlhdruj",
"random_integer": 302
},
"facility_label": "user",
"facility": "1",
"hostname": "pythonsysloglogstash_psl-project_1.pythonsysloglogstash_default",
"program": "",
"relayhost": "pythonsysloglogstash_psl-project_1.pythonsysloglogstash_default",
"relayip": "172.21.0.7",
"severity_label": "crit",
"severity": "2",
"tag": "",
"type": "syslog"
}
```