emeraldpay / emeraldpay/dshackle

Access log

Open
#24 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
350
Forks
57
PR merge metrics
No merged PRs in 30d

Description

Produce a text based access log compatible with Apache Combined Log format:

Apache Combined Log format is:
```
%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"
```

See also: https://httpd.apache.org/docs/2.4/logs.html

For example
```
127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326 "http://www.example.com/start.html" "Mozilla/4.08 [en] (Win98; I ;Nav)"
```

Standard (apache's) fields are:
- `%h` The IP address of the client.
- `%l` The identity of the client determined by identd on the client's machine. Will return a hyphen (-) if this information is not available.
- `%u` The userid of the client if the request was authenticated.
- `%t` The time that the request was received.
- `\"%r\"` The request line that includes the HTTP method used, the requested resource path, and the HTTP protocol that the client used.
- `%>s` The status code that the server sends back to the client.
- `%b`The size of the object requested.

Our changes:
- `%u` is an serial number of the remote TLS certificate, if TLS auth was used
- `%r` (request line) would contain blockchain + method, and type of the protocol may be `HTTP/2+gRPC`
- `%{Referer}` is a particular request id + response index, i.e. for batched queries and streaming response

Log lines are added on response, and there could be _multiple logs_ per one requests (batches, stream, etc).

Examples:
```
10.5.0.1 - 53f7446780fa803819da231f4068b25e [10/Jul/2020:13:55:36 +0000] "POST /ethereum/SubscribeBalance HTTP/2+gRPC" 200 2326 "a38ef37e4a53e852748b301370c710d7/5" "MyClient/1.0"
```
Which means that:
- a client from IP `10.5.0.1`
- authenticated with certificate `53:f7:44:67:80:fa:80:38:19:da:23:1f:40:68:b2:5e`
- using software `MyClient/1.0`
- made request to subscribe balance on Ethereum blockchain
- with original id `a38ef37e4a53e852748b301370c710d7`
- and current line represent response number `5`
- uses gRPC protocol with HTTP2
- request was successful and the current response was 2326 bytes

Contributor guide

No contributing guide indexed for this repository

Research direction

No files, tests, or entry points are named. Start with the Apache Combined Log format reference and trace where responses are logged, including batched and streaming responses. Done means producing compatible lines with the specified certificate, blockchain, protocol, request/response, client, and response-size fields.

Written by the indexing model from the issue text.

Assessment

Tech stack
blockchain, grpc, rust
Domain
backend-api-design, blockchain, observability
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.