Skip to content

Commit 27898dc

Browse files
committed
docs: adds transform configuration documentation to README
References #1
1 parent f4f4f60 commit 27898dc

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

README.md

+37
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,43 @@ npm install --global json-log-viewer
4141
jv application.log.2017-01-01 --sort -timestamp
4242
```
4343

44+
### Configuration
45+
46+
The default expected log format include fields `timestamp`, `level` and `message`. If the log file you're trying to parse doesn't include those fields, you can create a config file on your HOME path called `.json-log-viewer`.
47+
48+
For example, if your log lines look like this:
49+
50+
```json
51+
{
52+
"message":
53+
"Matched route \"**_heartbeat_check\" (parameters: \"_controller\": \"**\\Controller\\**Controller::heartbeatCheckAction\", \"_route\": \"**_heartbeat_check\")",
54+
"context": [],
55+
"level": 200,
56+
"level_name": "INFO",
57+
"channel": "request",
58+
"datetime": {
59+
"date": "2017-12-06 09:23:42.253060",
60+
"timezone_type": 3,
61+
"timezone": "Europe/Berlin"
62+
},
63+
"extra": []
64+
}
65+
```
66+
67+
You can create a mapping configuration like this:
68+
69+
```ini
70+
[transform]
71+
level=level_name
72+
timestamp=datetime.date
73+
message=message
74+
extra=$
75+
```
76+
77+
This way the messages will properly be displayed. The `$` has a special meaning: it tells the the old object should be included on the `extra` key on the resulting JSON. The result will look like this:
78+
79+
![transform](transform.png)
80+
4481
## Screenshots
4582

4683
__Details view__

transform.png

475 KB
Loading

0 commit comments

Comments
 (0)