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.
| 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): |
| ''' | |
| Extracted and modified from django-model-logging | |
| It used it's own LogEntry model but since django | |
| has it's own LogEntry maybe someone would want to | |
| register in the same model instead of creating a | |
| new one. | |
| ''' | |
| from django.contrib.admin.models import LogEntry, ADDITION, CHANGE, ContentType, DELETION | |
| from django.utils.translation import gettext as _ |
| """Implement a memorable ID string. | |
| The original idea for this comes from Asana where it is documented on their | |
| blog: | |
| http://blog.asana.com/2011/09/6-sad-squid-snuggle-softly/ | |
| There are other partial implementations of this and can be found here: | |
| Node.js: https://github.com/linus/greg | |
| Java: https://github.com/PerWiklander/IdentifierSentence |