Simple HTTP server receiving requests and dumping to flat file.
Start the listening HTTP server:
$ nodejs ./httprequestdump.js
Listening on 0.0.0.0:8080| #!/usr/bin/env python | |
| import gzip | |
| import os | |
| import sys | |
| import re | |
| INPUT_DIR = "nginx-logs" | |
| lineformat = re.compile(r"""(?P<ipaddress>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) - - \[(?P<dateandtime>\d{2}\/[a-z]{3}\/\d{4}:\d{2}:\d{2}:\d{2} (\+|\-)\d{4})\] ((\"(GET|POST) )(?P<url>.+)(http\/1\.1")) (?P<statuscode>\d{3}) (?P<bytessent>\d+) (["](?P<refferer>(\-)|(.+))["]) (["](?P<useragent>.+)["])""", re.IGNORECASE) |
| def seg_access_log(line): | |
| delimiters = {'[': ']', '"': '"'} | |
| idx, start, count, delimiter, results = 0, 0, len(line), ' ', [] | |
| while 1: | |
| idx = line.find(delimiter, start) | |
| delimiter = ' ' # reset | |
| if idx < 0: | |
| break |
| #!/bin/bash | |
| echo "Building NGINX along with Echo module" | |
| # install prerequisites | |
| yum -y install gcc gcc-c++ make zlib-devel pcre-devel openssl-devel | |
| # download the Echo module | |
| curl -L -O 'https://github.com/openresty/echo-nginx-module/archive/v0.58.tar.gz' | |
| tar -xzvf v0.58.tar.gz && rm v0.58.tar.gz | |
| mv echo-nginx-module-0.58 /tmp/echo-nginx-module |
| http { | |
| log_format bodylog '$remote_addr - $remote_user [$time_local] ' | |
| '"$request" $status $body_bytes_sent ' | |
| '"$http_referer" "$http_user_agent" $request_time ' | |
| '<"$request_body" >"$resp_body"'; | |
| lua_need_request_body on; | |
| set $resp_body ""; | |
| body_filter_by_lua ' |
글쓴이: 김정주([email protected])
이 글은 AWS 블로그를 참고하고 추가/보완하여 작성되었습니다.
Kinesis는 아마존 웹서비스(AWS)에서 제공하는 실시간 데이터 처리기이다.
| from flask import Flask | |
| from flask.ext.sqlalchemy import SQLAlchemy | |
| from flask.ext.wtf import Form | |
| from flask.ext.babel import gettext | |
| from wtforms import SelectField, TelField, TextField, FormField, Fieldlist, SubmitField | |
| from wtforms.validators import Optional, Required | |
| app = Flask(__name__) | |
| db = SQLAlchemy(app) |
| <!DOCTYPE HTML> | |
| <html> | |
| <head> | |
| <title>Safari SQLite Hello World Example</title> | |
| <script type="text/javascript" src="jquery-1.4.2.min.js"></script> | |
| <script type="text/javascript"> | |
| // The first thing we want to do is create the local | |
| // database (if it doesn't exist) or open the connection | |
| // if it does exist. Let's define some options for our |
| <?php | |
| /* | |
| * simple HttpRequest example using PHP | |
| * tom slankard | |
| */ | |
| class HttpRequest { | |
| public $url = null; |
| <scheme name="Eclectide Monokai" version="124" parent_scheme="Default"> | |
| <option name="LINE_SPACING" value="1.0" /> | |
| <option name="EDITOR_FONT_SIZE" value="12" /> | |
| <option name="EDITOR_FONT_NAME" value="Consolas" /> | |
| <colors> | |
| <option name="ADDED_LINES_COLOR" value="295622" /> | |
| <option name="CARET_COLOR" value="bbbbbb" /> | |
| <option name="CARET_ROW_COLOR" value="" /> | |
| <option name="CONSOLE_BACKGROUND_KEY" value="272822" /> | |
| <option name="FILESTATUS_ADDED" value="629755" /> |