msgstat/README.md

76 lines
3.3 KiB
Markdown
Raw Normal View History

2017-10-27 14:59:55 +00:00
Msgstat
----------
2017-10-31 11:25:47 +00:00
Msgstat provides a CLI tool which analyses status-go log files and generates corresponding output of information
2017-10-27 14:59:55 +00:00
related to messages delivered over whisper (either rpc or p2p).
2017-10-27 15:00:53 +00:00
2017-10-31 15:32:25 +00:00
## Usage
2017-10-27 15:00:53 +00:00
2017-10-31 15:32:25 +00:00
Msgstat provides the processing functionality for the processing of all log files which would be used to produced aggregated collection of message delivery facts.
2017-10-31 14:14:49 +00:00
2017-10-31 15:32:25 +00:00
It by defaults expects processing data to be delivered either through sending given logs through `stdin` or through the use of the `file` flag.
2017-10-27 15:00:53 +00:00
2017-10-31 14:14:49 +00:00
- Processing log lines through stdin
2017-10-31 15:32:25 +00:00
2017-10-27 15:00:53 +00:00
```bash
2017-10-31 15:32:25 +00:00
> cat ./logs/status-im/status-go/11.21.2017.log | msgstat
2017-10-27 15:00:53 +00:00
```
2017-10-31 14:14:49 +00:00
- Processing log lines from a file
2017-10-31 15:32:25 +00:00
2017-10-31 14:14:49 +00:00
```bash
> msgstat read -file=./logs/status-im/status-go/11.21.2017.log
```
2017-10-27 15:00:53 +00:00
2017-10-31 14:14:49 +00:00
Where all information is delivered through the `stdout`, except when the use of the `-out` flag is used.
2017-10-27 15:00:53 +00:00
2017-10-31 14:14:49 +00:00
### Flags
#### `-file=./status-log`
This flag is used to indicate that all a file should be used to retrieve all log lines to be processed line by line for the generation of processed log facts.
#### `-out=./processed-log.json`
This flag is used to indicate that all processed data should be stored into provided file.
#### `-format=json|yaml|csv`
This flag is used to dictate the encoding format which should be used for generation of processed resource which would
then be processed by external tools as needed.
### Log Format
Msgstat expects that all log contain log lines seperated by new lines, and it targets logs which mark this format:
```
INFO [10-31|14:57:13] Message delivery notification geth=StatusIM state=eyJ0eXBlIjoiSW5jb21pbmdNZXNzYWdlIiwicHJvdG9jb2wiOiJSUEMiLCJzdGF0dXMiOiJDYWNoZWQi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ines with matching `Mesage Delivery Notification` and extract the `state` field and value which contains the needed delivery facts.
### Report Format
2017-10-27 15:00:53 +00:00
Msgstat currently outputs parsed message into the following format:
2017-10-31 11:25:47 +00:00
```json
{
2017-11-01 17:15:26 +00:00
"protocol": "RPC",
"envelope": "#4T0NEM0Qrcm1uVVhBVmhYYW9HS1AwQ01xWmhwQmJGSDBnOHZpWnN2",
2017-10-31 11:25:47 +00:00
"from_device": "4T0NEM0Qrcm1uVVhBVmhYYW9HS1A",
2017-11-01 17:15:26 +00:00
"to_device": "4T0NEM0Qrcm1uVVhBVmhYYW9HS1A",
2017-10-31 11:25:47 +00:00
"time": 2010-11-12,
2017-11-01 17:15:26 +00:00
"timelines": [
2017-10-31 11:25:47 +00:00
{
"time_stamp": "2010-11-12 10:20:100T34343",
"status": "pending"
},
{
"time_stamp": "2010-11-12 3:20:100T34343",
"status": "rejected",
"reason": "Failed to locate peer"
}
],
"payload": "Thunder crash",
2017-10-27 15:00:53 +00:00
}
2017-10-31 11:25:47 +00:00
```