Skip to content

Commit 7e97822

Browse files
committed
Updating the readme and removing the parselogs specific one
1 parent 1dc31c8 commit 7e97822

File tree

2 files changed

+50
-40
lines changed

2 files changed

+50
-40
lines changed

README.md

Lines changed: 50 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,113 @@
1-
# cortextool
1+
# Cortex Tools
22

3-
This tool is designed to interact with the various user facing APIs provided by Cortex, as well as, interact with various backend storage components containing Cortex data.
3+
This repo contains tools used for interacting with [Cortex](https://github.com/cortexproject/cortex).
44

5-
## Config Commands
5+
* [cortextool](#cortextool): Interacts with user-facing Cortex APIs and backend storage components
6+
* [chunktool](#chunktool): Interacts with chunks stored and indexed in Cortex storage backends.
7+
* [parselogs](#parselogs): Tool which parses Cortex query-frontend logs and formats them for easy analysis.
8+
9+
## cortextool
10+
11+
This tool is designed to interact with the various user-facing APIs provided by Cortex, as well as, interact with various backend storage components containing Cortex data.
12+
13+
### Config Commands
614

715
Config commands interact with the Cortex api and read/create/update/delete user configs from Cortex. Specifically a users alertmanager and rule configs can be composed and updated using these commands.
816

9-
### Configuration
17+
#### Configuration
1018

1119
| Env Variables | Flag | Description |
1220
| ----------------- | --------- | ------------------------------------------------------------------------------------------------------------- |
1321
| CORTEX_ADDRESS | `address` | Addess of the API of the desired Cortex cluster. |
1422
| CORTEX_API_KEY | `key` | In cases where the Cortex API is set behind a basic auth gateway, an key can be set as a basic auth password. |
1523
| CORTEX_TENANT_ID | `id` | The tenant ID of the Cortex instance to interact with. |
1624

17-
### Alertmanager
25+
#### Alertmanager
1826

1927
The following commands are used by users to interact with their Cortex alertmanager configuration, as well as their alert template files.
2028

21-
#### Alertmanager Get
29+
##### Alertmanager Get
2230

2331
cortextool alertmanager get
2432

25-
#### Alertmanager Load
33+
##### Alertmanager Load
2634

2735
cortextool alertmanager load ./example_alertmanager_config.yaml
2836

29-
### Rules
37+
#### Rules
3038

3139
The following commands are used by users to interact with their Cortex ruler configuration. They can load prometheus rule files, as well as interact with individual rule groups.
3240

33-
#### Rules List
41+
##### Rules List
3442

3543
This command will retrieve all of the rule groups stored in the specified Cortex instance and print each one by rule group name and namespace to the terminal.
3644

3745
cortextool rules list
3846

39-
#### Rules Print
47+
##### Rules Print
4048

4149
This command will retrieve all of the rule groups stored in the specified Cortex instance and print them to the terminal.
4250

4351
cortextool rules print
4452

45-
#### Rules Get
53+
##### Rules Get
4654

4755
This command will retrieve the specified rule group from Cortex and print it to the terminal.
4856

4957
cortextool rules get example_namespace example_rule_group
5058

51-
#### Rules Delete
59+
##### Rules Delete
5260

5361
This command will retrieve the specified rule group from Cortex and print it to the terminal.
5462

5563
cortextool rules delete example_namespace example_rule_group
5664

57-
#### Rules Load
65+
##### Rules Load
5866

5967
This command will load each rule group in the specified files and load them into Cortex. If a rule already exists in Cortex it will be overwritten if a diff is found.
6068

6169
cortextool rules load ./example_rules_one.yaml ./example_rules_two.yaml ...
6270

63-
# chunktool
71+
## chunktool
6472

6573
This repo also contains the `chunktool`. A client meant to interact with chunks stored and indexed in cortex backends.
6674

67-
### Chunk Delete
75+
#### Chunk Delete
6876

6977
The delete command currently cleans all index entries pointing to chunks in the specified index. Only bigtable and the v10 schema are currently fully supported. This will not delete the entire index entry, only the corresponding chunk entries within the index row.
7078

71-
### Chunk Migrate
79+
#### Chunk Migrate
7280

7381
The migrate command helps with migrating chunks across cortex clusters. It also takes care of setting right index in the new cluster as per the specified schema config.
7482

7583
As of now it only supports `Bigtable` or `GCS` as a source to read chunks from for migration while for writing it supports all the storages that Cortex supports.
7684
More details about it [here](./pkg/chunk/migrate/README.md)
7785

78-
## License
86+
## parselogs
87+
88+
A CLI tool to parse Cortex query-frontend logs and formats them for easy analysis.
89+
90+
```
91+
Options:
92+
-dur duration
93+
only show queries which took longer than this duration, e.g. -dur 10s
94+
-query
95+
show the query
96+
-utc
97+
show timestamp in UTC time
98+
```
99+
100+
Feed logs into it using `logcli` from Loki, `kubectl` from Kubernetes, `cat` from a file, or any other way to get raw logs:
101+
102+
```
103+
$ cat query-frontend-logs.log | ./parselogs -dur 5s
104+
Timestamp TraceID Length Duration Status Path
105+
2020-05-26 13:51:15.0577354 -0400 EDT 76b9939fd5c78b8f 6h0m0s 10.249149614s (200) /api/prom/api/v1/query_range
106+
2020-05-26 13:52:15.771988849 -0400 EDT 2e7473ab10160630 10h33m0s 7.472855362s (200) /api/prom/api/v1/query_range
107+
2020-05-26 13:53:46.712563497 -0400 EDT 761f3221dcdd85de 10h33m0s 11.874296689s (200) /api/prom/api/v1/query_range
108+
```
109+
110+
111+
### License
79112

80113
Licensed Apache 2.0, see [LICENSE](LICENSE).

cmd/parselogs/README.md

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)