Skip to content

Instantly share code, notes, and snippets.

View Laxman-SM's full-sized avatar

Laxman Singh Laxman-SM

  • Ex-Phenome, Ex-Intertrust, Ex-Wipro
  • US, Hyderabad (india)
View GitHub Profile
@Laxman-SM
Laxman-SM / logstash.conf
Created May 17, 2017 11:50 — forked from clodio/logstash.conf
kibana_logstah_elasticserch geolocation from custom field
input {
file {
path => "/tmp/access_log"
start_position => "beginning"
#echo '98.83.179.51 - - [18/May/2011:19:35:08 -0700] "GET /css/main.css HTTP/1.1" 290 566 "http://www.safesand.com/information.htm" "Mozilla/5.0 (Windows NT 6.0; WOW64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1"1837' >>/tmp/access_log
}
}
filter {
@Laxman-SM
Laxman-SM / ELK-install.sh
Created May 17, 2017 12:04 — forked from sniper7kills/ELK-install.sh
ELK-Install-Ubuntu-16.04
#/bin/bash
#Ask some info
echo -n "Enter ELK Server IP or FQDN: "
read eip
echo -n "Enter Admin Web Password: "
read adpwd
#Update System
sudo apt-get update
sudo apt-get upgrade -y
@Laxman-SM
Laxman-SM / esnog19-elk-workshop
Created May 17, 2017 12:22 — forked from ioc32/esnog19-elk-workshop
ELK configs, grok regexs and playbook
root@esnog19:/etc/logstash# cat conf.d/inputs-intermediate.conf
input {
file {
path => "/home/malibu/data/nokia.log"
start_position => "beginning"
type => "nokia"
codec => multiline {
pattern => "^\d+\s+\d{4}"
what => "previous"
# Captures are a slightly modified version of logstash "grok" patterns, with
# the format %{<capture syntax>[:<semantic name>][:<modifier>]}
# By default all named captures are converted into string fields.
# Modifiers can be used to convert captures to other types or tags.
# Timestamp modifiers can be used to convert captures to the timestamp of the
# parsed metric.
# View logstash grok pattern docs here:
# https://www.elastic.co/guide/en/logstash/current/plugins-filters-grok.html
# All default logstash patterns are supported, these can be viewed here:
#!/bin/bash
#
# FROM Nagios script to check website is up and responding in a timely manner
# Written by Chris Freeman ([email protected])
# Version 1.1
# (c) GPLv2 2011
#
# Special thanks to dkwiebe and Konstantine Vinogradov for suggestions and feedback
#
# MODIFIED BY Claude seguret to add graphite metrics
@Laxman-SM
Laxman-SM / docker.md
Created June 13, 2017 05:02 — forked from wang-zhijun/docker.md
docker

Docker SwarmでGo Appを動かすときログをファイルに吐き出しても、コンテナ内部のファイルに吐き出しているだけで、dockerのscratchイメージベースに作られているイメージはそもそもShellはない、ログをホストに出したいので、docker servce createコマンドに--mountオプションを使って、コンテナの中のファイルとホストのファイルを紐づくことができる。

結論からいうとしたのコマンドで

docker service create --replicas 2 --env ATHENA_ENV=dev --name athena -p 3000:3000 --mount type=bind,source=/var/log/athena/console.log,destination=/console.log  dg-general-use.objectstorage.cloud.egg.jp:5000/athena:1.2.3

事前にDocker Swarmの各ホストに/var/log/athena/console.logファイルを作成する必要がある。

# little monstruosity i wrote, probably done with 10x fewer characters with sed
# and maybe 5x fewer characters with ruby, but python is still my native language :)
git status | grep \.svn | python -c "import re, sys; sys.stdout.write('\n'.join(set([res[0] for res in [re.findall('file:\s+(.*?\.svn)', line) for line in sys.stdin.readlines()] if len(res) > 0])));" | python -c "import os, sys; [os.system('git rm -rf %s' % line) for line in sys.stdin.readlines()]"
@Laxman-SM
Laxman-SM / benchmark-druid.sh
Created July 10, 2017 10:30 — forked from xvrl/benchmark-druid.sh
Benchmarking Druid
# ./benchmark-druid.R <host> [datasource] [outputname] [count]
./benchmark-druid.R <compute_node> tpch_lineitem_small results/druid-m3-2xlarge-1x.tsv
./benchmark-druid.R <compute_node> tpch_lineitem results/100gb-druid-m3-2xlarge-1x.tsv 20
./benchmark-druid.R <broker_node> tpch_lineitem results/100gb-druid-m3-2xlarge-6x.tsv 20
@Laxman-SM
Laxman-SM / README.md
Created July 10, 2017 10:41
Create docker-machine on AWS

Two commands to create Docker Machines on AWS

Notes:

  • Spot instances can't be restarted.
  • Elastic IPs will need to be manually associated after creation (or scripted using Boto/AWS CLI). Associated Elastic IPs will survive stop/start, however.
@Laxman-SM
Laxman-SM / update-docker-config.sh
Created July 12, 2017 16:37 — forked from wdullaer/update-docker-config.sh
Expose docker socket over unsecure TCP with systemd
#!/bin/bash
mkdir -p /etc/systemd/system/docker.service.d
cat <<EOF > /etc/systemd/system/docker.service.d/override.conf
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2375
EOF
sudo systemctl daemon-reload
sudo service docker restart