Skip to content

Instantly share code, notes, and snippets.

@asigatchov
asigatchov / flientd_filter.conf
Created December 28, 2016 19:12
Пример использование filter
<filter es.**>
@type record_transformer
enable_ruby
auto_typecast true
<record>
hostname ${hostname}
bitps ${record["size"] * 8 / (record["resptime"] + 0.001)}
</record>
</filter>
@asigatchov
asigatchov / flientd_match.conf
Created December 28, 2016 19:29
fluentd пример блока сохранения данных в elasticsearch
<match *.**>
@type elasticsearch_dynamic
buffer_type memory
buffer_chunk_limit 100m
buffer_queue_limit 128
logstash_format true
logstash_prefix ${tag_parts[1]}
include_tag_key true
tag_key @log_name
host 127.0.0.1
@asigatchov
asigatchov / td-agent.conf
Created December 28, 2016 20:19
Пример td-agent.conf для демонстрации
<source>
@type tail
format /(?<schema>https?)://(?<domain>[^ ]*) (?<remote>[^ ]*) (?<host>[^ ]*) (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^\"]*?)(?: +\S*)?)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>[^\"]*)" "(?<agent>[^\"]*)") (?<message>.*) (?<resptime>\d+\.\d+)$/
time_format %d/%b/%Y:%H:%M:%S %z
types remote:string,host:string,user:string,time:time,method:string,path:string,code:integer,referer:string,agent:string,message:string,size:integer,resptime:float
path /tmp/access.log
pos_file /tmp/access_tail_pos.log
tag es.demo.access
read_lines_limit 1000
</source>
@asigatchov
asigatchov / 01-nginx.toml
Created March 22, 2017 20:10
конфиг файл для heka
[nginx_access_logs]
type = "LogstreamerInput"
splitter = "TokenSplitter"
decoder = "nginx_access_decoder"
log_directory = "/opt/nginx/logs"
file_match = 'access\.log'
[nginx_access_decoder]
type = "SandboxDecoder"
@asigatchov
asigatchov / elasticsearch.conf
Created March 22, 2017 20:18
Пример конфига baseauth на основе nginx
upstream elastic {
server elasticsearch:9200;
}
client_max_body_size 1G;
client_body_buffer_size 200M;
server {
listen *:9200;
server_name _;
location / {
version: '2'
services:
nginx-proxy:
image: jwilder/nginx-proxy
ports:
- "80:80"
- "443:443"
restart: unless-stopped
volumes:
- "/etc/nginx/vhost.d"
<?php
$data = json_decode(file_get_contents('php://input'), true);
$data['first_name'] .= " " . md5($data['first_name']);
$data['last_name'] .= " " . md5($data['last_name']);
$data['say'] = 'PHP is Good';
$data['current_time'] = date("Y-m-d H:m:s z");
echo json_encode($data, JSON_UNESCAPED_UNICODE);
user www-data;
pid /run/nginx.pid;
worker_processes 2;
worker_rlimit_nofile 65535;
#include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 8192;
server {
listen 8080;
root /home/ubuntu/sigatchov/php;
index orel-codes.php index.html index.htm index.nginx-debian.html;
# server_name example.com;
location / {
}
location ~ \.php$ {
@asigatchov
asigatchov / docker-iptables.sh
Created April 12, 2019 10:08
docker iptables
#!/usr/bin/env bash
# Usage:
# timeout 10 docker_iptables.sh
#
# Use the builtin shell timeout utility to prevent infinite loop (see below)
if [ ! -x /usr/bin/docker ]; then
exit
fi