There's so many way to send logs to an elk... logspout, filebeat, journalbeat, etc.
But docker has a gelf log driver and logstash a gelf input. So here we are.
Here is a docker-compose to test a full elk with a container sending logs via gelf.
| 0x42Ea7075F16e355DE9D9F69D146A439AC4Cb6030 |
| did:3:kjzl6cwe1jw148xcqovn1cjnzplqpmjxmc9hscas80mzv1tuaz5hl8tfnseiqoe |
| import hash from 'object-hash' | |
| import sizeof from 'object-sizeof' | |
| import lruCache from 'lru-cache' | |
| const cacheEnabled = true | |
| const cacheMaxAge = 30 * 60 * 1000 | |
| const cacheMaxSize = 128 * 1000 * 1000 | |
| const getCacheKey = obj => hash(obj) |
| /* | |
| This file is part of web3.js. | |
| web3.js is free software: you can redistribute it and/or modify | |
| it under the terms of the GNU Lesser General Public License as published by | |
| the Free Software Foundation, either version 3 of the License, or | |
| (at your option) any later version. | |
| web3.js is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| GNU Lesser General Public License for more details. |
| class Gena { | |
| constructor(config) { | |
| this.currentGeneration = 0 | |
| this.populations = [] | |
| this.fitnesses = [] | |
| this.mutateProbability = config.mutateProbability || 0.5 // 0 ~ 1 | |
| this.generationsSize = config.generationsSize || 100 | |
| this.populationSize = config.populationSize || 100 | |
| this.doneFitness = config.doneFitness || 1 // 0 ~ 1 |
| sINKK2vpkhC1+2sLwG02ZY38bCQv+n+1G06lBY7Dm/p4cKqTJKpM2ZImCOhhJCkTosOCLTqh0gYoY5HR25NZPz1K |
| # This file defines a decorator '@log_to()' that logs every call to a | |
| # function, along with the arguments that function was called with. It | |
| # takes a logging function, which is any function that accepts a | |
| # string and does something with it. A good choice is the debug | |
| # function from the logging module. A second decorator '@logdebug' is | |
| # provided that uses 'logging.debug' as the logger. | |
| from __future__ import print_function | |
| from functools import wraps | |
| from inspect import getcallargs, getargspec |
There's so many way to send logs to an elk... logspout, filebeat, journalbeat, etc.
But docker has a gelf log driver and logstash a gelf input. So here we are.
Here is a docker-compose to test a full elk with a container sending logs via gelf.
| 'use strict'; | |
| const assert = require('assert'); | |
| /** | |
| * The redis client is https://github.com/luin/ioredis | |
| */ | |
| /* | |
| const redisClient = new Redis({ |
| class DRFLoggerMixin(object): | |
| """ | |
| Allows us to log any incoming request and to know what's in it. | |
| Usage: | |
| class MyOwnViewSet(DRFLoggerMixin, | |
| mixins.ListModelMixin, | |
| … | |
| viewsets.GenericViewSet): |