Skip to content

Instantly share code, notes, and snippets.

@chenyg0911
chenyg0911 / custom-logging.py
Created July 13, 2017 07:24
python logging config
# -*- coding: utf-8 -*-
import logging
import logging.config
logging.addLevelName(5, 'TRACE')
logging.addLevelName(30, 'WARN')
logging.addLevelName(50, 'FATAL')
logging.config.fileConfig('mylogging.conf')
@chenyg0911
chenyg0911 / mongodb_collection_sizes.js
Created June 15, 2017 04:11 — forked from joeyAghion/mongodb_collection_sizes.js
List mongodb collections in descending order of size. Helpful for finding largest collections. First number is "size," second is "storageSize."
var collectionNames = db.getCollectionNames(), stats = [];
collectionNames.forEach(function (n) { stats.push(db[n].stats()); });
stats = stats.sort(function(a, b) { return b['size'] - a['size']; });
for (var c in stats) { print(stats[c]['ns'] + ": " + stats[c]['size'] + " (" + stats[c]['storageSize'] + ")"); }
##################### ElasticSearch Configuration Example #####################
# This file contains an overview of various configuration settings,
# targeted at operations staff. Application developers should
# consult the guide at <http://elasticsearch.org/guide>.
#
# The installation procedure is covered at
# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/setup.html>.
#
# ElasticSearch comes with reasonable defaults for most settings,
input {
tcp {
port => 1514
type => syslog
}
udp {
port => 1514
type => syslog
}
tcp {