Commit b8a7ca9c authored by Harsh Chouraria's avatar Harsh Chouraria Committed by Achilleas Pipinellis

Add command to print log time range

Just a simple addition of a command that
grabs the first/last line and extracts time into
a nice range-like output
parent 918509b3
......@@ -14,10 +14,12 @@ Find more about them [in Audit Events documentation](audit_events.md).
System log files are typically plain text in a standard log file format.
This guide talks about how to read and use these system log files.
Read more about how to
[customize logging on Omnibus GitLab installations](https://docs.gitlab.com/omnibus/settings/logs.html)
Read more about the log system and using the logs:
- [Customize logging on Omnibus GitLab installations](https://docs.gitlab.com/omnibus/settings/logs.html)
including adjusting log retention, log forwarding,
switching logs from JSON to plain text logging, and more.
- [How to parse and analyze JSON logs](troubleshooting/log_parsing.md).
## `production_json.log`
......
......@@ -41,6 +41,20 @@ jq -cR 'fromjson?' file.json | jq <COMMAND>
By default `jq` will error out when it encounters a line that is not valid JSON.
This skips over all invalid lines and parses the rest.
#### Print a JSON log's time range
```shell
cat log.json | (head -1; tail -1) | jq '.time'
```
Use `zcat` if the file has been rotated and compressed:
```shell
zcat @400000006026b71d1a7af804.s | (head -1; tail -1) | jq '.time'
zcat some_json.log.25.gz | (head -1; tail -1) | jq '.time'
```
### Parsing `production_json.log` and `api_json.log`
#### Find all requests with a 5XX status code
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment