Skip to content

Commit cfa1e34

Browse files
committed
Changing name to logtool
1 parent deed686 commit cfa1e34

File tree

6 files changed

+29
-13
lines changed

6 files changed

+29
-13
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
cmd/cortextool/cortextool
22
cmd/chunktool/chunktool
3+
cmd/logtool/logtool
34
.uptodate
45
.pkg
56
.cache
67
images/
78
dist/
89
.DS_STORE
9-
cmd/parselogs/parselogs

Makefile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ GIT_REVISION := $(shell git rev-parse --short HEAD)
77
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
88
GO_FLAGS := -mod=vendor -ldflags "-extldflags \"-static\" -s -w -X $(VPREFIX).Branch=$(GIT_BRANCH) -X $(VPREFIX).Version=$(IMAGE_TAG) -X $(VPREFIX).Revision=$(GIT_REVISION)" -tags netgo
99

10-
all: cortextool chunktool
11-
images: cortextool-image chunktool-image
10+
all: cortextool chunktool logtool
11+
images: cortextool-image chunktool-image logtool-image
1212
cortextool: cmd/cortextool/cortextool
1313
chunktool: cmd/chunktool/chunktool
14+
logtool: cmd/logtool/logtool
1415

1516
cortextool-image:
1617
$(SUDO) docker build -t $(IMAGE_PREFIX)/cortextool -f cmd/cortextool/Dockerfile .
@@ -20,22 +21,31 @@ chunktool-image:
2021
$(SUDO) docker build -t $(IMAGE_PREFIX)/chunktool -f cmd/chunktool/Dockerfile .
2122
$(SUDO) docker tag $(IMAGE_PREFIX)/chunktool $(IMAGE_PREFIX)/chunktool:$(IMAGE_TAG)
2223

24+
logtool-image:
25+
$(SUDO) docker build -t $(IMAGE_PREFIX)/logtool -f cmd/logtool/Dockerfile .
26+
$(SUDO) docker tag $(IMAGE_PREFIX)/logtool $(IMAGE_PREFIX)/logtool:$(IMAGE_TAG)
27+
2328
cmd/cortextool/cortextool: $(APP_GO_FILES) cmd/cortextool/main.go
2429
CGO_ENABLED=0 go build $(GO_FLAGS) -o $@ ./$(@D)
2530

2631
cmd/chunktool/chunktool: $(APP_GO_FILES) cmd/chunktool/main.go
2732
CGO_ENABLED=0 go build $(GO_FLAGS) -o $@ ./$(@D)
2833

34+
cmd/logtool/logtool: $(APP_GO_FILES) cmd/logtool/main.go
35+
CGO_ENABLED=0 go build $(GO_FLAGS) -o $@ ./$(@D)
36+
2937
lint:
3038
golangci-lint run -v
3139

3240
cross:
3341
CGO_ENABLED=0 gox -output="dist/{{.Dir}}-{{.OS}}-{{.Arch}}" -ldflags=${LDFLAGS} -arch="amd64" -os="linux windows darwin" ./cmd/cortextool
3442
CGO_ENABLED=0 gox -output="dist/{{.Dir}}-{{.OS}}-{{.Arch}}" -ldflags=${LDFLAGS} -arch="amd64" -os="linux windows darwin" ./cmd/chunktool
43+
CGO_ENABLED=0 gox -output="dist/{{.Dir}}-{{.OS}}-{{.Arch}}" -ldflags=${LDFLAGS} -arch="amd64" -os="linux windows darwin" ./cmd/logtool
3544

3645
test:
3746
go test -mod=vendor -p=8 ./...
3847

3948
clean:
4049
rm -rf cmd/cortextool/cortextool
4150
rm -rf cmd/chunktool/chunktool
51+
rm -rf cmd/logtool/logtool

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This repo contains tools used for interacting with [Cortex](https://github.com/c
44

55
* [cortextool](#cortextool): Interacts with user-facing Cortex APIs and backend storage components
66
* [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.
7+
* [logtool](#logtool): Tool which parses Cortex query-frontend logs and formats them for easy analysis.
88

99
## cortextool
1010

@@ -105,7 +105,7 @@ The migrate command helps with migrating chunks across cortex clusters. It also
105105
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.
106106
More details about it [here](./pkg/chunk/migrate/README.md)
107107

108-
## parselogs
108+
## logtool
109109

110110
A CLI tool to parse Cortex query-frontend logs and formats them for easy analysis.
111111

@@ -123,7 +123,7 @@ Feed logs into it using [`logcli`](https://github.com/grafana/loki/blob/master/d
123123

124124
Loki `logcli` example:
125125
```
126-
$ logcli query '{cluster="us-central1", name="query-frontend", namespace="dev"}' --limit=5000 --since=3h --forward -o raw | ./parselogs -dur 5s
126+
$ logcli query '{cluster="us-central1", name="query-frontend", namespace="dev"}' --limit=5000 --since=3h --forward -o raw | ./logtool -dur 5s
127127
https://logs-dev-ops-tools1.grafana.net/loki/api/v1/query_range?direction=FORWARD&end=1591119479093405000&limit=5000&query=%7Bcluster%3D%22us-central1%22%2C+name%3D%22query-frontend%22%2C+namespace%3D%22dev%22%7D&start=1591108679093405000
128128
Common labels: {cluster="us-central1", container_name="query-frontend", job="dev/query-frontend", level="debug", name="query-frontend", namespace="dev", pod_template_hash="7cd4bf469d", stream="stderr"}
129129
@@ -134,7 +134,7 @@ Timestamp TraceID Length Duration
134134
```
135135

136136
```
137-
$ cat query-frontend-logs.log | ./parselogs -dur 5s
137+
$ cat query-frontend-logs.log | ./logtool -dur 5s
138138
Timestamp TraceID Length Duration Status Path
139139
2020-05-26 13:51:15.0577354 -0400 EDT 76b9939fd5c78b8f 6h0m0s 10.249149614s (200) /api/prom/api/v1/query_range
140140
2020-05-26 13:52:15.771988849 -0400 EDT 2e7473ab10160630 10h33m0s 7.472855362s (200) /api/prom/api/v1/query_range

cmd/logtool/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM golang:1.12.5-stretch as build
2+
ARG GOARCH="amd64"
3+
COPY . /build_dir
4+
WORKDIR /build_dir
5+
ENV GOPROXY=https://proxy.golang.org
6+
RUN make clean && make logtool
7+
8+
FROM alpine:3.9
9+
RUN apk add --update --no-cache ca-certificates
10+
COPY --from=build /build_dir/cmd/logtool/logtool /usr/bin/logtool
11+
EXPOSE 80
12+
ENTRYPOINT [ "/usr/bin/logtool" ]

cmd/parselogs/Makefile

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

0 commit comments

Comments
 (0)