log-replay

Replay nginx/haproxy/solr logs for the sake of stress testing

Github星跟蹤圖

Replay Nginx/Haproxy/SOLR logs

MIT License
Build
Go Report Card

Installation

go get -u github.com/Gonzih/log-replay

Usage

Usage of log-replay:
  -debug
        Print extra debugging information
  -enable-window
        Enable rolling window functionality to stop log replaying in case of failure
  -error-rate float
        Percentage of the error to stop log replaying (min:1, max:99) (default 40)
  -file string
        Log file name to read. Read from STDIN if file name is '-' (default "-")
  -file-type string
        Input log type (nginx, haproxy or solr) (default "nginx")
  -format string
        Nginx log format (default "$remote_addr [$time_local] \"$request\" $status $request_length $body_bytes_sent $request_time \"$t_size\" $read_time $gen_time")
  -log string
        File to report timings to, default is stdout (default "-")
  -password string
        Basic auth password
  -prefix string
        URL prefix to query (default "http://localhost")
  -ratio int
        Replay speed ratio, higher means faster replay speed (default 1)
  -skip-sleep
        Skip sleep between http calls based on log timestamps
  -ssl-skip-verify
        Should HTTP client ignore ssl errors
  -timeout int
        Request timeout in milliseconds, 0 means no timeout (default 60000)
  -user-name string
        Basic auth username
  -window-size int
        Size of the window to track response status (default 1000)
# Replay access log
log-replay --file my-acces.log --debug --log out.log

# Duplicate traffic on the staging host - with basic auth
tail -f /var/log/acces.log, log-replay --prefix http://staging-host --log staging.log --skip-sleep \
      --user-name test-user --password supersecrEt

Output log format

Log is tab separated values:

status	start-time	duration	url payload err

# Examples
200	1469792268	629904766	/my-url
500	1469792268	629904766	/my-url	Get http://localhost/another-url: dial tcp [::1]:80: getsockopt: connection refused
  • status is integer
  • start-time is unix timestamp in seconds
  • duration is in nanoseconds
  • url is full url with prefix
  • payload is stringified post data
  • error is go lang error formatted to string and is optional

Only GET?

Nginx/Haproxy logs are currently limited to GET only.
SOLR requests will use post format for everything, as a way to subvert GET length limitations.

Log formats

  • To correctly use the solr adapter, it is required that the log4 pattern is configured as follows:
<PatternLayout>
  <pattern>%d %p %C{1.} [%t] %m%n%ex</pattern>
</PatternLayout>

License

MIT

主要指標

概覽
名稱與所有者Gonzih/log-replay
主編程語言Go
編程語言Go (語言數: 1)
平台
許可證MIT License
所有者活动
創建於2016-07-21 11:06:14
推送於2024-09-01 10:29:18
最后一次提交2022-12-21 12:13:29
發布數5
最新版本名稱v0.0.5 (發布於 )
第一版名稱v0.0.1 (發布於 )
用户参与
星數67
關注者數5
派生數15
提交數87
已啟用問題?
問題數5
打開的問題數0
拉請求數7
打開的拉請求數1
關閉的拉請求數0
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?