Skip to content

Commit e4378c0

Browse files
committed
Merge branch 'release/v1.1.0'
2 parents c4bffdd + 8b592c7 commit e4378c0

File tree

10 files changed

+115
-15
lines changed

10 files changed

+115
-15
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,6 @@ jsconfig.json
4545

4646
*.pb.go
4747
go-logsink
48+
go-logsink.osx
49+
go-logsink.exe
4850
dist/

.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v1.0.2
1+
v1.1.0

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
linux:
2+
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-s' -o go-logsink
3+
osx:
4+
CGO_ENABLED=0 GOOS=darwin go build -a -ldflags '-s' -o go-logsink.osx
5+
windows:
6+
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -a -ldflags '-s' -o go-logsink.exe
7+
protobuf:
8+
./check_protobuf.sh
9+
protoc -I logsink/ logsink/logsink.proto --go_out=plugins=grpc:logsink
10+
statik:
11+
cd web && statik -src=../web
12+
all: linux osx windows

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ More usage: See [go-logsink documentation](docs/go-logsink.md)
3838

3939
## Relay
4040

41+
_DEPRECATED_ Recommended solution is to use `go-logsing listen ... | go-logsing connect ...`
42+
4143
If you want to forward data from one network to another you can do this using the relay method.
4244

4345
|--------| |-------| |--------|
@@ -82,7 +84,10 @@ Rudimentary tests were done, no in depth testing, though
8284

8385
|Version|Description|
8486
|---|---|
85-
v1.0.2|Graceful shutdown|
87+
|v1.1.0|Web included in binary|
88+
||Deprecated relaying|
89+
||Added prometheus metrics|
90+
|v1.0.2|Graceful shutdown|
8691
|v1.0.1|go-ps|
8792
|v1.0.0|New versioning scheme|
8893
||Lockfile support|

check_protobuf.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#! /bin/bash
2+
3+
which protoc
4+
if [ $? != 0 ]; then
5+
echo "Protocol buffer installation not found"
6+
exit 1
7+
fi
8+
9+
which protoc-gen-go
10+
if [ $? != 0 ]; then
11+
echo "Installing go extension for protocol buffers"
12+
go get -u github.com/golang/protobuf/protoc-gen-go
13+
fi

cmd/relay.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ var relayCmd = &cobra.Command{
3030
Long: `Instead of dumping incoming messages a relay forwards
3131
the messages to another go-logsink instance`,
3232
Run: func(cmd *cobra.Command, args []string) {
33+
log.Println("!! Relaying is deprecated")
3334
if "" != viper.GetString("lockfile") {
3435
lock, err := lockfile.New(viper.GetString("lockfile"))
3536
if err != nil {

vendor/vendor.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,24 @@
2626
"revision": "8ee79997227bf9b34611aee7946ae64735e6fd93",
2727
"revisionTime": "2016-11-17T03:31:26Z"
2828
},
29+
{
30+
"checksumSHA1": "GEOcEfTErKBV6xEvZGjYy2LV0PI=",
31+
"path": "github.com/google/gops/agent",
32+
"revision": "62f833fc9f6c4d3223bdb37bd0c2f8951bed8596",
33+
"revisionTime": "2017-03-19T00:29:31Z"
34+
},
35+
{
36+
"checksumSHA1": "JReTqQzncYSyvJbrmfBWZHMZfQU=",
37+
"path": "github.com/google/gops/internal",
38+
"revision": "62f833fc9f6c4d3223bdb37bd0c2f8951bed8596",
39+
"revisionTime": "2017-03-19T00:29:31Z"
40+
},
41+
{
42+
"checksumSHA1": "OPlS4cJsOSpZ/FrUOJtfJXikjII=",
43+
"path": "github.com/google/gops/signal",
44+
"revision": "62f833fc9f6c4d3223bdb37bd0c2f8951bed8596",
45+
"revisionTime": "2017-03-19T00:29:31Z"
46+
},
2947
{
3048
"checksumSHA1": "g/V4qrXjUGG9B+e3hB+4NAYJ5Gs=",
3149
"path": "github.com/gorilla/context",
@@ -128,6 +146,12 @@
128146
"revision": "bfdb1a85537d60bc7e954e600c250219ea497417",
129147
"revisionTime": "2016-12-11T22:23:15Z"
130148
},
149+
{
150+
"checksumSHA1": "aCtmlyAgau9n0UHs8Pk+3xfIaVk=",
151+
"path": "github.com/nightlyone/lockfile",
152+
"revision": "1d49c987357a327b5b03aa84cbddd582c328615d",
153+
"revisionTime": "2016-09-28T00:14:32Z"
154+
},
131155
{
132156
"checksumSHA1": "8Y05Pz7onrQPcVWW6JStSsYRh6E=",
133157
"path": "github.com/pelletier/go-buffruneio",
@@ -140,6 +164,12 @@
140164
"revision": "439fbba1f887c286024370cb4f281ba815c4c7d7",
141165
"revisionTime": "2016-12-29T18:51:04Z"
142166
},
167+
{
168+
"checksumSHA1": "++Uxr4F++QrnFEbBlQsJ3VuQoNM=",
169+
"path": "github.com/rakyll/statik/fs",
170+
"revision": "89fe3459b5c829c32e89bdff9c43f18aad728f2f",
171+
"revisionTime": "2017-04-10T19:29:44Z"
172+
},
143173
{
144174
"checksumSHA1": "JdYdBoNxMR+CDqTfs78cQmY8JtI=",
145175
"origin": "github.com/cpuguy83/go-md2man/vendor/github.com/russross/blackfriday",

web/server.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ type server struct {
2121

2222
// SendLine implements logsink.SendLine
2323
func (s *server) SendLine(ctx context.Context, in *pb.LineMessage) (*pb.LineResult, error) {
24+
numberOfLines.Inc()
2425
breakAt := viper.GetInt("web.break")
2526
if breakAt == 0 {
2627
s.hub.broadcast <- []byte(in.Line)

web/statik/statik.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package statik
2+
3+
import (
4+
"github.com/rakyll/statik/fs"
5+
)
6+
7+
func init() {
8+
data := "PK\x03\x04\x14\x00\x08\x00\x08\x00\xd2\x908J\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0c\x00\x00\x00css/main.csst\x8e\xc1N\x04!\x0c\x86\xef<E/\x1e1\xac7\x99\xa7\xe9\x0e\xdd\xa5\x11(\xe9\xb0\xce\xacf\xdf\xdd\x00\xc6D\x13\x8f\xfd\xbe/\x7fz\x96p\x87O\x03\x10x\xab \xef\x1e.\x89\x8e\xc5\x00d.6\x12_c\xf3pr\xee=v\xd8\xa5\x0d\xac\xb46\x96\xe2a\x95t\xcbe1\x0fc2r\x19K\xbd\xf1p\x02\x07xk2\xdc\xf3*\xa5!\x17\xd2Q\x00d\xd4+\x17\xff\xd3Lv\xd8\x9dC\x8b\x1e\xb8pcL\x93\x7f\xb3W\xf74\xb7.|P\x18;U6\x9e\x7f\x0c\xd6s\x9d\x0f\xbf\xb8\xd1V\xa5\x11\xee\x91\x1b\xd9\xad\xe2J\x1e\xaa\x92\xdd\x15\xeb\xf2W\xd8,\x1f\xf6\x7f+\xbf\x9dh\x18\x87\x87\xb3\x12\xbe\xd9\x0e\x16\xf3\xf8\n\x00\x00\xff\xffPK\x07\x08f\x9d\x83$\xbe\x00\x00\x00Q\x01\x00\x00PK\x03\x04\x14\x00\x08\x00\x08\x00\xea\x908J\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00index.html\xb4WMs\xdb6\x13\xbe\xe7Wlpz\xdfiIX\xc9\xa4\x1f\x0e\xc5N\xc7m\xdat\xeci;\xf2\xa5G\x10\\\x92+\x83\x00\x0b@_\xf9\xf5\x1d\x10\x94D\xd2\xf2\xc4\xf5\xa4\x07\x9b\x04\x88\xdd\xe7\xd9O\xac\xb2\xd7?\xfd~s\xff\xd7\x1f?C\xe3[\x95\xbf\xca\xe2\x03 kP\x94\xe1\x05 {\x9d$\x1f\xdb\xceX\x0f\xbf\x18S+\x84\x8f\xd2h\xf8`\xb4O\x92\xe1\x88\"\xfd\x00\x8d\xc5j\xc9\x1a\xef\xbbk\xce+\xa3\xbdK\xeb^@t\xe4RiZN\xd2\xe8\x1f*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30\xbb\xfes\x83\xf6\x00\x05V\xc6\"\x8c\xc7\xbc\xb5;\x0d]\xb1\xdd\x8f\x9a\x16?_\x02\x0c\x9c\x95\xa3\xf1\xd2\x94\x98\xae\xff\x0eJ\xfb\xc92\xbe&o\xd2E\xba\xe8'\xc7\xb5\x0b%\x1be\xcfl\x9e\x98n\x7f\x13[\xb1\x8a\xe0s2S\xd4\x7f=\xd4\xae\x1f\xcf\xb4\x17\x98\x8d\xb1\xd6\xc3$;?\x96\xf18>f\xbc\xff\xd9\xf0O\x00\x00\x00\xff\xffPK\x07\x08\xd0\x07\xc88\x08\x04\x00\x00M\x0c\x00\x00PK\x03\x04\x14\x00\x08\x00\x08\x00\xea\x908J\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00js/main.js\x9cUAo\xb38\x10\xbd\xf3+\xa6\x1cZ\xa3nI\xcfK\xc9a\xabV])\xdb=\xb4\xd2j\xb5\xfb\x1d\x0cL\x88U\xe3A\xb6IZE\xfe\xef\x9f\x0c\x84\x10\x926\xd5\x97K\x8c\x99y\xf3\xde\xf8yXs\x0d&\xd7$\xa5P\xe5\x83\xe2\x99\xc4\x02R\xb0\xba\xc1$\xf0/\xa5P\xb8\x10\x95\xb0\x90\xc2v\x1b\xb7K\xe7\xbaw\xaa\xa92\xd4\x7f/\x17B\xa1\x81\x14n\xbbm|\xaf5\xa4\x10\x86I\x10,\x1b\x95[A\n\x84yn\xa3\x99\x8a`\x1b\x00h\xb4\x8dVp!\xcc3\x7ff5\xd7\x06\x1f%q\xcbT\x14\xc1\xe5%\x08\xf3(\x94\xb0\xc8T\x94\x04.\x086B\x15\xb4\x89II\xe2\x9e\xe1\x00\xcc:<\x00_:'\xa5\x92\xf6i\xd8\x92TB\n\x05\xe5M\x85\xca\xc6%\xda\x07\x89~\xf9\xc7\xc7\x9f\x05\x0b%\x95a4J\x19py]\xa3*\x16T2\xdf\x82]\x11\xff\x13K`\x17~3\xae\xb8\xcdW\xcc\x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x84K\x02\x97\x04\x81\xa5\xb2\x94/\xbb\xf9s\xf2\xab0\x9dN\xe9\xc5t'\x19n\xe2W\x93\xecSr\xbb\xb9V\x96\x12=\xcb\x83A< \x86\x9fx\xf2\xd7`k\xde\x18,\x06;\xba\x9f\x01\x00\x00\xff\xffPK\x07\x08\xa1qn\x8b\xac\x02\x00\x00\xc6\x07\x00\x00PK\x01\x02\x14\x03\x14\x00\x08\x00\x08\x00\xd2\x908Jf\x9d\x83$\xbe\x00\x00\x00Q\x01\x00\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb4\x81\x00\x00\x00\x00css/main.cssPK\x01\x02\x14\x03\x14\x00\x08\x00\x08\x00\xea\x908J\xd0\x07\xc88\x08\x04\x00\x00M\x0c\x00\x00\n\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb4\x81\xf8\x00\x00\x00index.htmlPK\x01\x02\x14\x03\x14\x00\x08\x00\x08\x00\xea\x908J\xa1qn\x8b\xac\x02\x00\x00\xc6\x07\x00\x00\n\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb4\x818\x05\x00\x00js/main.jsPK\x05\x06\x00\x00\x00\x00\x03\x00\x03\x00\xaa\x00\x00\x00\x1c\x08\x00\x00\x00\x00"
9+
fs.Register(data)
10+
}

web/web.go

Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,36 @@
1515
package web
1616

1717
import (
18+
"bytes"
1819
"context"
1920
"fmt"
2021
"log"
2122
"net/http"
2223
"os"
2324
"os/signal"
24-
"path/filepath"
2525
"text/template"
2626
"time"
2727

2828
"strings"
2929

3030
"github.com/gorilla/handlers"
3131
"github.com/gorilla/mux"
32-
"github.com/kardianos/osext"
32+
"github.com/prometheus/client_golang/prometheus"
33+
"github.com/prometheus/client_golang/prometheus/promhttp"
3334
"github.com/spf13/viper"
35+
36+
"github.com/rakyll/statik/fs"
37+
38+
_ "github.com/sascha-andres/go-logsink/web/statik" // get access to data
39+
)
40+
41+
var (
42+
statikFS http.FileSystem
43+
jsTemplate *template.Template
44+
numberOfLines = prometheus.NewCounter(prometheus.CounterOpts{
45+
Name: "log_lines",
46+
Help: "Number of lines received",
47+
})
3448
)
3549

3650
type templateData struct {
@@ -49,12 +63,6 @@ func serveMainjs(w http.ResponseWriter, r *http.Request) {
4963
return
5064
}
5165
w.Header().Set("Content-Type", "text/javascript; charset=utf-8")
52-
dir, err := osext.ExecutableFolder()
53-
if err != nil {
54-
http.Error(w, "Web data not found", 417)
55-
return
56-
}
57-
jsTemplate := template.Must(template.ParseFiles(filepath.Join(dir, "www/js/main.js")))
5866
jsTemplate.Execute(w, templateData{Host: r.Host, Limit: int32(viper.GetInt("web.limit")), Scheme: getScheme(r)})
5967
}
6068

@@ -83,16 +91,15 @@ func Start() {
8391
srv := &server{}
8492
go srv.run()
8593

94+
prometheus.MustRegister(numberOfLines)
95+
8696
r := mux.NewRouter()
8797
r.HandleFunc("/js/main.js", serveMainjs) // js template
8898
r.HandleFunc("/api/go-logsink/ws", func(w http.ResponseWriter, r *http.Request) {
8999
serveWs(srv.hub, w, r)
90100
})
91-
dir, err := osext.ExecutableFolder()
92-
if err != nil {
93-
log.Fatal("Could not locate directory")
94-
}
95-
r.PathPrefix("/").Handler(handlers.CombinedLoggingHandler(os.Stdout, http.FileServer(http.Dir(filepath.Join(dir, "www"))))) // static files
101+
r.Handle("/metrics", promhttp.Handler())
102+
r.PathPrefix("/").Handler(handlers.CombinedLoggingHandler(os.Stdout, http.FileServer(statikFS))) // static files
96103
http.Handle("/", r)
97104
stop := make(chan os.Signal)
98105
signal.Notify(stop, os.Interrupt)
@@ -110,3 +117,22 @@ func Start() {
110117
h.Shutdown(ctx)
111118
log.Println("Server gracefully stopped")
112119
}
120+
121+
func init() {
122+
files, err := fs.New()
123+
if err != nil {
124+
log.Fatal("Error initializing filesystem: ", err)
125+
}
126+
statikFS = files
127+
file, err := statikFS.Open("/js/main.js")
128+
if err != nil {
129+
log.Fatal("Error reading js template: ", err)
130+
}
131+
buf := new(bytes.Buffer)
132+
buf.ReadFrom(file)
133+
tmpl, err := template.New("jsTemplate").Parse(buf.String())
134+
if err != nil {
135+
log.Fatal("Error parsing template: ", err)
136+
}
137+
jsTemplate = tmpl
138+
}

0 commit comments

Comments
 (0)