Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ui] add '/config' page #3619

Merged
merged 4 commits into from
Jul 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions clients/pkg/promtail/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ package config

import (
"flag"
"fmt"

"github.com/grafana/loki/clients/pkg/promtail/client"
"github.com/grafana/loki/clients/pkg/promtail/positions"
"github.com/grafana/loki/clients/pkg/promtail/scrapeconfig"
"github.com/grafana/loki/clients/pkg/promtail/server"
"github.com/grafana/loki/clients/pkg/promtail/targets/file"
yaml "gopkg.in/yaml.v2"
)

// Config for promtail, describing what files to watch.
Expand All @@ -34,3 +36,11 @@ func (c *Config) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet) {
func (c *Config) RegisterFlags(f *flag.FlagSet) {
c.RegisterFlagsWithPrefix("", f)
}

func (c Config) String() string {
b, err := yaml.Marshal(c)
if err != nil {
return fmt.Sprintf("<error creating config string: %s>", err)
}
return string(b)
}
2 changes: 1 addition & 1 deletion clients/pkg/promtail/promtail.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func New(cfg config.Config, dryRun bool, opts ...Option) (*Promtail, error) {
return nil, err
}
promtail.targetManagers = tms
server, err := server.New(cfg.ServerConfig, promtail.logger, tms)
server, err := server.New(cfg.ServerConfig, promtail.logger, tms, cfg.String())
if err != nil {
return nil, err
}
Expand Down
15 changes: 14 additions & 1 deletion clients/pkg/promtail/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type server struct {
tms *targets.TargetManagers
externalURL *url.URL
healthCheckTarget bool
promtailCfg string
}

// Config extends weaveworks server config
Expand All @@ -67,7 +68,7 @@ func (cfg *Config) RegisterFlags(f *flag.FlagSet) {
}

// New makes a new Server
func New(cfg Config, log log.Logger, tms *targets.TargetManagers) (Server, error) {
func New(cfg Config, log log.Logger, tms *targets.TargetManagers, promtailCfg string) (Server, error) {
if cfg.Disable {
return newNoopServer(log), nil
}
Expand All @@ -93,13 +94,15 @@ func New(cfg Config, log log.Logger, tms *targets.TargetManagers) (Server, error
tms: tms,
externalURL: externalURL,
healthCheckTarget: healthCheckTargetFlag,
promtailCfg: promtailCfg,
}

serv.HTTP.Path("/").Handler(http.RedirectHandler(path.Join(serv.externalURL.Path, "/targets"), 303))
serv.HTTP.Path("/ready").Handler(http.HandlerFunc(serv.ready))
serv.HTTP.PathPrefix("/static/").Handler(http.FileServer(ui.Assets))
serv.HTTP.Path("/service-discovery").Handler(http.HandlerFunc(serv.serviceDiscovery))
serv.HTTP.Path("/targets").Handler(http.HandlerFunc(serv.targets))
serv.HTTP.Path("/config").Handler(http.HandlerFunc(serv.config))
serv.HTTP.Path("/debug/fgprof").Handler(fgprof.Handler())
return serv, nil
}
Expand Down Expand Up @@ -172,6 +175,16 @@ func (s *server) serviceDiscovery(rw http.ResponseWriter, req *http.Request) {
})
}

func (s *server) config(rw http.ResponseWriter, req *http.Request) {
executeTemplate(req.Context(), rw, templateOptions{
Data: s.promtailCfg,
BuildVersion: version.Info(),
Name: "config.html",
PageTitle: "Config",
ExternalURL: s.externalURL,
})
}

// targets serves the targets page.
func (s *server) targets(rw http.ResponseWriter, req *http.Request) {
executeTemplate(req.Context(), rw, templateOptions{
Expand Down
28 changes: 26 additions & 2 deletions clients/pkg/promtail/server/ui/assets_vfsdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ var Assets = func() http.FileSystem {
name: "css",
modTime: time.Date(1970, 1, 1, 0, 0, 1, 0, time.UTC),
},
"/static/css/config.css": &vfsgen۰CompressedFileInfo{
name: "config.css",
modTime: time.Date(1970, 1, 1, 0, 0, 1, 0, time.UTC),
uncompressedSize: 236,

compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x02\xff\x6c\x8f\xd1\xca\xc3\x20\x0c\x85\xef\x7d\x8a\x80\xd7\x96\xbf\xf8\xf7\x62\xfa\x30\x43\x4d\x5b\xa4\xce\x88\xb6\xac\xdd\xe8\xbb\x8f\xd6\x0d\x76\x31\x72\x11\xf2\x25\xe1\x9c\xd3\xd8\x39\xc2\x93\x01\x00\x58\xca\xd8\x67\x91\x0d\xfa\xa5\x28\xf8\xd3\x6c\x67\x8c\x3b\x8a\x83\x1f\xaf\x9b\xb9\x85\xf7\x1d\xfa\x92\x82\xd9\x14\xd8\x40\x6e\xd2\x27\x4b\x06\xd1\xc7\x51\xc1\xa5\xe9\xd2\x5a\xd9\x40\x71\x16\xc5\x3f\x7a\x05\xad\xfc\x40\x47\x81\xb2\xe2\x52\xca\x3a\xdf\x29\xa3\xb0\xb9\x37\x93\x82\xb3\x09\x13\x42\x5d\x59\xe3\xa6\x31\xd3\x12\x51\xd4\x2f\xe0\x43\x77\x94\xfe\xb2\xab\xa0\x4d\x2b\x14\x0a\x1e\x81\x3b\xe7\xf4\xaf\x28\xff\x87\xfa\xce\x5e\x01\x00\x00\xff\xff\x37\x6a\x09\x4c\xec\x00\x00\x00"),
},
"/static/css/promtail.css": &vfsgen۰CompressedFileInfo{
name: "promtail.css",
modTime: time.Date(1970, 1, 1, 0, 0, 1, 0, time.UTC),
Expand Down Expand Up @@ -60,6 +67,13 @@ var Assets = func() http.FileSystem {
name: "js",
modTime: time.Date(1970, 1, 1, 0, 0, 1, 0, time.UTC),
},
"/static/js/config.js": &vfsgen۰CompressedFileInfo{
name: "config.js",
modTime: time.Date(1970, 1, 1, 0, 0, 1, 0, time.UTC),
uncompressedSize: 363,

compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x02\xff\x94\x90\xb1\x4a\x04\x31\x10\x86\xfb\x3c\xc5\x10\xaf\x98\x80\xec\x0b\x2c\x36\x1e\x16\x36\x16\x6a\x2f\x71\x32\xb7\x04\x93\x99\x65\xcd\x79\x06\xb9\x77\x97\x44\x08\xd7\xc9\xa5\x0a\xc3\xf7\xff\xf3\x31\x87\xa3\x50\x89\x2a\x10\x25\x16\x74\xf0\x63\x00\x00\x76\x68\x6f\x48\xd7\xfa\xaa\xfb\x14\xd7\x77\xf5\x5b\xb0\x6e\x52\x41\x4b\x29\xd2\x87\xbd\x85\x91\x1b\x99\xf6\xbe\xfc\x06\x9b\x97\x85\xe1\x0e\x82\xd2\x31\xb3\x94\x89\x36\xf6\x85\x9f\xdb\x18\xdd\x3c\xd8\xce\x4d\x9f\x9c\x98\xca\x93\x06\xc6\x11\x58\xb8\x3c\x24\x6e\xdf\xfb\xfa\x18\xd0\x92\xca\x21\x2e\x6f\xd5\xe7\x64\xdd\x45\xc3\x29\x4a\xd0\x53\xc3\x5f\x7a\x4b\x54\x41\x37\x71\x5e\x4b\xc5\x7f\x31\x1f\xc2\x9f\x52\xf7\xb8\xc0\x87\x06\x7f\x33\xed\x35\x67\x2f\xdd\x61\xad\xf6\xba\xdd\x67\x37\x9b\xb3\x31\x3b\x6c\xa7\x75\xb3\xf9\x0d\x00\x00\xff\xff\xce\xe7\x15\x39\x6b\x01\x00\x00"),
},
"/static/js/targets.js": &vfsgen۰CompressedFileInfo{
name: "targets.js",
modTime: time.Date(1970, 1, 1, 0, 0, 1, 0, time.UTC),
Expand Down Expand Up @@ -451,9 +465,16 @@ var Assets = func() http.FileSystem {
"/templates/_base.html": &vfsgen۰CompressedFileInfo{
name: "_base.html",
modTime: time.Date(1970, 1, 1, 0, 0, 1, 0, time.UTC),
uncompressedSize: 2758,
uncompressedSize: 2870,

compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x02\xff\xbc\x56\xff\x6b\xe4\xb6\x13\xfd\x3d\x7f\x85\x4e\xf7\x81\x4b\xe0\x23\x8b\xe3\xae\x50\x7a\xb6\x4b\x9b\xa4\x5c\xa0\xf4\xc2\xdd\xf6\x68\x29\x25\x8c\x6d\xd9\x56\x22\x4b\x3a\x69\xec\xee\xb2\xec\xff\x5e\xb4\xde\x6f\xf6\xae\x93\xb6\x34\xdd\x5f\x6c\x8d\xf4\xe6\x8d\x66\xde\x3e\x1c\xbf\xb8\xfa\x70\x39\xfb\xf5\xf6\x9a\xd4\xd8\xa8\xf4\x2c\x0e\x0f\xa2\x40\x57\x09\x15\x9a\xa6\x67\x84\x10\x12\xd7\x02\x8a\xfe\x75\xbd\x6c\x04\x02\xa9\x11\x2d\x13\x5f\x5a\xd9\x25\xf4\xd2\x68\x14\x1a\xd9\x6c\x61\x05\x25\x79\xbf\x4a\x28\x8a\x39\xf2\x90\xf0\x1d\xc9\x6b\x70\x5e\x60\xd2\x62\xc9\xbe\xa6\xe3\x5c\x1a\x1a\x91\x50\x67\x32\x83\xfe\x00\xaf\x8d\xd4\x85\x98\xff\x5f\x9b\xd2\x28\x65\xfe\x38\xc4\xa1\x44\x25\xd2\xe5\x92\x58\xa8\xc4\x2c\x2c\xc8\x6a\x15\xf3\x3e\xbc\x3f\xa6\xa4\x7e\x20\x4e\xa8\x84\xfa\xda\x38\xcc\x5b\x24\x32\x37\x9a\x92\xda\x89\x32\xa1\x6b\x3c\xd6\xb7\x4e\x94\x72\x4e\x56\x2b\xee\x11\x50\xe6\x5c\x36\x15\x2f\xa1\x0b\x47\x23\x99\x9b\x6f\xbb\x64\xb9\x24\x59\x2b\x55\xf1\x59\x38\x2f\x8d\x26\xab\xd5\x61\x35\x3e\x77\xd2\x22\xf1\x2e\x9f\xce\xd9\x09\x5d\x18\xc7\xef\x3d\xbf\xff\xd2\x0a\xb7\x60\x6f\xa2\xaf\xa2\xd7\x51\x23\x75\x74\xef\x27\x18\x62\xde\x67\xfe\xc7\x54\xd6\x58\x2b\xdc\x73\x92\x64\xc6\xa0\x47\x07\x96\xbd\x8d\x5e\x47\x6f\x02\xe9\x2e\xf4\x57\x79\x47\xf3\xc2\x85\x15\x1b\xf5\xe4\xde\xd3\xcd\xfc\x70\xa1\x84\xaf\x85\xc0\xa7\x86\x37\x51\x58\xee\xc7\x95\xe5\xde\x3f\x39\xd9\x7f\xa3\xa0\xc0\x6c\x9d\x69\x10\xa4\xfa\xcf\x48\xc7\x5d\x78\xcb\x2a\xb5\xb0\x75\x90\xb4\x1f\xf6\xe2\x60\xe3\xa9\xb6\x8c\x15\xb2\xaf\x39\xfc\x3a\x70\xe4\xf6\xbb\xd9\xfb\xbb\xdb\x8f\xd7\x3f\xdc\xfc\x42\x12\x72\x54\x1d\x7d\x77\x84\xf8\xfe\xe7\x9b\x1f\xaf\xee\x3e\x5f\x7f\xfc\x74\xf3\xe1\xa7\x0d\x66\xcc\x3c\x44\xfd\xef\xbc\x6c\x75\x8e\x61\xef\xfc\x82\x2c\x07\x7b\xfd\xfe\xab\xdf\x0a\x40\x60\x68\xaa\x4a\x85\x26\x1a\xa3\x50\x5a\xfa\xfb\xab\x8b\x68\xf3\x7e\x7e\x31\x80\xad\xf6\xcb\x13\xb2\x5c\x2e\x51\x34\x56\x01\x0a\x42\x83\x17\x52\x12\xad\x56\xbd\x35\xf2\xde\x1b\xfb\x45\x66\x8a\xc5\xc1\x18\x35\x74\x24\x57\xe0\x7d\x42\x35\x74\x19\x38\x52\xca\xb9\x28\x18\x1a\x4b\xfa\x00\x13\x73\x0b\xba\x60\xbe\xd9\x06\x0a\x70\x0f\x24\xab\xd6\x4f\x3a\x6c\x6f\x5c\xc8\x5d\xbe\xe0\x91\x20\xb5\x70\xac\x54\xad\x2c\x0e\x47\xb3\x3b\x9e\xb5\x88\x46\x6f\x74\xd4\x2f\xe8\xb0\x9e\x4d\x83\x1c\x25\x83\x76\xe5\x46\x29\xb0\x5e\x6c\xc3\xe0\x2a\x81\x09\x7d\xa9\xa1\x63\x1b\x73\xa6\x04\x9c\x84\x4d\xf9\xa2\x48\x68\x09\x2a\x00\xd6\xd1\x70\xc6\x19\xd5\xd3\x8c\x10\x0a\xb2\xa0\xe3\xd9\x9a\x2a\x5c\x5a\x56\x10\x26\x39\xba\xeb\x5e\x67\x16\xf4\xe9\xa2\xd9\xda\xc8\x83\x8b\x58\xd0\x13\xe8\x17\x8c\x1d\x26\xf0\x8e\x19\xad\x16\x34\x3d\xa2\x7f\x2c\xcb\x51\x1d\x81\x98\x65\xe0\x1e\x27\x7f\x2e\x18\x63\xc7\xc0\x98\xf7\xf3\x3d\x25\x03\x18\xb5\x2f\x73\xa0\x8b\xad\x7b\xbc\xa4\xe9\xed\xc6\x99\x62\x0e\xe9\xd9\x09\x7c\x50\x9d\x2c\x46\xb3\x1c\xa6\xdc\x0a\x86\xec\x94\x33\x31\x8f\x56\x8d\x90\x1a\x3a\xfa\x48\x1f\x94\x3c\x38\xcf\x24\x8a\x86\xa6\x83\x0b\xb1\x60\x95\xd3\x56\x28\x5c\x27\x73\xc1\x0a\xe9\x73\xd3\x09\xb7\xa0\xe9\xa7\x3e\x44\xae\xb6\xa1\x70\xed\x98\x2b\xf9\x7c\x55\xf4\xff\x1f\x4f\xd3\x59\xff\xf2\xfc\x8c\xb9\xd1\xa5\xac\x68\x7a\xb9\x7e\xfe\x1d\x3e\xb2\x27\x24\xd3\xe7\x0f\x75\x45\x8e\xeb\x09\x9f\x86\xfe\x1b\xce\x2b\x89\x75\x9b\x45\xb9\x69\x78\xe5\xa0\x04\x0d\x5c\x99\x07\x49\xc9\xd6\x51\xee\x32\x05\xfa\x81\xa6\xef\x85\xb2\x6b\xf9\x4d\x92\x4d\x96\x1f\xf3\x56\x9d\xfa\x3f\x14\xb2\x1b\xb9\xe7\x30\x14\x73\x0d\xdd\x84\xc5\xef\x54\xbe\x77\xf9\xde\xd9\x63\xde\x7f\x25\xff\x19\x00\x00\xff\xff\x6f\xbd\x43\xc6\x36\x0b\x00\x00"),
},
"/templates/config.html": &vfsgen۰CompressedFileInfo{
name: "config.html",
modTime: time.Date(1970, 1, 1, 0, 0, 1, 0, time.UTC),
uncompressedSize: 473,

compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x02\xff\xbc\x56\x7f\x8b\xdc\x36\x10\xfd\xff\x3e\x85\xa2\x14\x72\x07\x95\x45\x48\x0a\xa5\xb1\x5d\xda\xdc\x95\x1c\x94\xe6\x48\xb6\xa1\xa5\x94\x63\x6c\xcb\xb6\xee\x64\x49\x91\xc6\xee\x2e\xcb\x7e\xf7\xa2\xf5\xfe\xb2\x77\x7d\xd7\x96\x5e\xf6\x9f\xb5\x46\x7a\xf3\x46\x33\xcf\x0f\xc7\xcf\x2e\xdf\xbf\x9d\xfd\x7e\x73\x45\x6a\x6c\x54\x7a\x16\x87\x3f\xa2\x40\x57\x09\x15\x9a\xa6\x67\x84\x10\x12\xd7\x02\x8a\xfe\x71\xbd\x6c\x04\x02\xa9\x11\x2d\x13\x9f\x5b\xd9\x25\xf4\xad\xd1\x28\x34\xb2\xd9\xc2\x0a\x4a\xf2\x7e\x95\x50\x14\x73\xe4\x21\xe1\x1b\x92\xd7\xe0\xbc\xc0\xa4\xc5\x92\x7d\x4b\xc7\xb9\x34\x34\x22\xa1\xce\x64\x06\xfd\x01\x5e\x1b\xa9\x0b\x31\xff\x5a\x9b\xd2\x28\x65\xfe\x3a\xc4\xa1\x44\x25\xd2\xe5\x92\x58\xa8\xc4\x2c\x2c\xc8\x6a\x15\xf3\x3e\xbc\x3f\xa6\xa4\xbe\x27\x4e\xa8\x84\xfa\xda\x38\xcc\x5b\x24\x32\x37\x9a\x92\xda\x89\x32\xa1\x6b\x3c\xd6\x37\x4e\x94\x72\x4e\x56\x2b\xee\x11\x50\xe6\x5c\x36\x15\x2f\xa1\x0b\x47\x23\x99\x9b\xef\xbb\x64\xb9\x24\x59\x2b\x55\xf1\x49\x38\x2f\x8d\x26\xab\xd5\x61\x35\x3e\x77\xd2\x22\xf1\x2e\x9f\xce\xd9\x09\x5d\x18\xc7\xef\x3c\xbf\xfb\xdc\x0a\xb7\x60\xaf\xa2\x6f\xa2\x97\x51\x23\x75\x74\xe7\x27\x18\x62\xde\x67\xfe\xcf\x54\xd6\x58\x2b\xdc\x53\x92\x64\xc6\xa0\x47\x07\x96\xbd\x8e\x5e\x46\xaf\x02\xe9\x2e\xf4\x4f\x79\x47\xf3\xc2\x85\x15\x1b\xf5\xe4\xde\xd3\xcd\xfc\x70\xa1\x84\xaf\x85\xc0\xc7\x86\x37\x51\x58\xee\xc7\x95\xe5\xde\x3f\x3a\xd9\xff\xa3\xa0\xc0\x6c\x9d\x69\x10\xa4\xfa\x62\xa4\xe3\x2e\xbc\x66\x95\x5a\xd8\x3a\x48\xda\x0f\x7b\x71\xb0\xf1\x58\x5b\xc6\x0a\xd9\xd7\x1c\x7e\x1d\x38\x72\xf3\xc3\xec\xdd\xed\xcd\x87\xab\x9f\xae\x7f\x23\x09\x39\xaa\x8e\xbe\x39\x42\xfc\xf8\xeb\xf5\xcf\x97\xb7\x9f\xae\x3e\x7c\xbc\x7e\xff\xcb\x06\x33\x66\x1e\xa2\xbe\x3a\x2f\x5b\x9d\x63\xd8\x3b\xbf\x20\xcb\xc1\x5e\xbf\xff\xe2\x8f\x02\x10\x18\x9a\xaa\x52\xa1\x89\xc6\x28\x94\x96\xfe\xf9\xe2\x22\xda\x3c\x9f\x5f\x0c\x60\xab\xfd\xf2\x84\x2c\x97\x4b\x14\x8d\x55\x80\x82\xd0\xe0\x85\x94\x44\xab\x55\x6f\x8d\xbc\xf7\xc6\x7e\x91\x99\x62\x71\x30\x46\x0d\x1d\xc9\x15\x78\x9f\x50\x0d\x5d\x06\x8e\x94\x72\x2e\x0a\x86\xc6\x92\x3e\xc0\xc4\xdc\x82\x2e\x98\x6f\xb6\x81\x02\xdc\x3d\xc9\xaa\xf5\x3f\x1d\xb6\x37\x2e\xe4\x2e\x5f\xf0\x48\x90\x5a\x38\x56\xaa\x56\x16\x87\xa3\xd9\x1d\xcf\x5a\x44\xa3\x37\x3a\xea\x17\x74\x58\xcf\xa6\x41\x8e\x92\x41\xbb\x72\xa3\x14\x58\x2f\xb6\x61\x70\x95\xc0\x84\x3e\xd7\xd0\xb1\x8d\x39\x53\x02\x4e\xc2\xa6\x7c\x51\x24\xb4\x04\x15\x00\xeb\x68\x38\xe3\x8c\xea\x69\x46\x08\x05\x59\xd0\xf1\x6c\x4d\x15\x2e\x2d\x2b\x08\x93\x1c\xdd\x75\xaf\x33\x0b\xfa\x74\xd1\x6c\x6d\xe4\xc1\x45\x2c\xe8\x09\xf4\x33\xc6\x0e\x13\x78\xc7\x8c\x56\x0b\x9a\x1e\xd1\x3f\x94\xe5\xa8\x8e\x40\xcc\x32\x70\x0f\x93\x3f\x15\x8c\xb1\x63\x60\xcc\xfb\xf9\x9e\x92\x01\x8c\xda\x97\x39\xd0\xc5\xd6\x3d\x9e\xd3\xf4\x66\xe3\x4c\x31\x87\xf4\xec\x04\x3e\xa8\x4e\x16\xa3\x59\x0e\x53\x6e\x05\x43\x76\xca\x99\x98\x47\xab\x46\x48\x0d\x1d\x7d\xa0\x0f\x4a\x1e\x9c\x67\x12\x45\x43\xd3\xc1\x85\x58\xb0\xca\x69\x2b\x14\xae\x93\xb9\x60\x85\xf4\xb9\xe9\x84\x5b\xd0\xf4\x63\x1f\x22\x97\xdb\x50\xb8\x76\xcc\x95\x7c\xba\x2a\xfa\xf7\xc7\xd3\x74\xd6\x3f\xfc\x1b\x46\xb2\xa7\x24\xd3\xe7\x0f\xe7\x4c\x8e\x2b\x0a\x9f\x6a\xfe\x3b\xce\x2b\x89\x75\x9b\x45\xb9\x69\x78\xe5\xa0\x04\x0d\x5c\x99\x7b\x49\xc9\xf6\x0d\xbf\xcd\x14\xe8\x7b\x9a\xbe\x13\xca\xae\xe5\x30\x49\x36\x59\x7e\xcc\x5b\x75\x4a\x9f\x85\xec\x46\x6e\x36\x0c\xc5\x5c\x43\x37\x61\xb9\x3b\xd5\xed\x5d\xb7\x77\xda\x98\xf7\x5f\xad\x7f\x07\x00\x00\xff\xff\xe9\xc8\xa1\xc0\xc6\x0a\x00\x00"),
compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x02\xff\x74\xd0\xb1\x8e\x02\x21\x10\x06\xe0\x7e\x9f\x62\x42\xaf\x24\xd6\xec\x5e\xe1\x0b\x5c\x71\xb9\xf6\xc2\xc2\xac\x3b\x1e\x02\x81\x59\xe3\x86\xf0\xee\x17\x45\x4f\x1b\xcb\x61\xc2\xc7\xff\x53\x8a\xc5\x89\x3c\x82\x98\x51\x5b\x51\x6b\x07\x00\xa0\x1c\xf9\x5f\xe0\x35\x62\x2f\x18\x2f\x2c\x4d\xce\x02\x12\xba\x5e\x64\x5e\x1d\xe6\x19\x91\x05\xcc\x09\xa7\x5e\x94\x02\x51\xf3\xfc\x99\x70\xa2\x0b\xd4\x2a\x33\x6b\x26\x73\xbd\x23\x4d\xf0\x13\x1d\xb6\x26\xe7\x8f\x73\x5f\x0a\x8c\x0b\x39\xfb\x8d\x29\x53\xf0\x50\xab\x18\xda\x73\xd9\x24\x8a\x0c\x39\x99\xf7\xdc\xf1\x5f\x3b\xbe\xc3\x94\x6c\xd0\xd0\x95\x82\xde\xd6\xda\x75\xcf\x7e\x26\x78\x46\xcf\xad\xa2\xb2\x74\x06\xe3\x74\xce\xfd\x6d\xa1\xc9\x63\xda\x4c\x6e\x21\xfb\xc8\x34\xef\x80\xec\x6d\x3b\xd1\x61\x49\x9a\x29\x78\x31\xec\x5f\x47\x50\xe3\xc2\x1c\xfc\xfd\xa7\xda\x20\x1e\xee\xc8\x1e\x46\xf6\x9b\x98\xe8\xa4\xd3\x2a\xee\x5c\x5c\xbf\xc2\xde\x51\x1c\x83\x4e\xf6\x0a\xc6\x15\x38\x80\x79\x1c\x29\xd9\x9c\x41\xc9\x79\x37\x74\x2d\x4c\x4c\xf8\x92\xe6\x67\xd5\x27\x27\x86\x52\xb6\xb5\x2a\x19\x13\x5e\x23\x2b\x69\xe9\xfc\x6c\xfe\x17\x00\x00\xff\xff\x58\xde\x94\x08\xd9\x01\x00\x00"),
},
"/templates/service-discovery.html": &vfsgen۰CompressedFileInfo{
name: "service-discovery.html",
Expand Down Expand Up @@ -481,13 +502,15 @@ var Assets = func() http.FileSystem {
fs["/static/vendor"].(os.FileInfo),
}
fs["/static/css"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
fs["/static/css/config.css"].(os.FileInfo),
fs["/static/css/promtail.css"].(os.FileInfo),
fs["/static/css/targets.css"].(os.FileInfo),
}
fs["/static/img"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
fs["/static/img/favicon.ico"].(os.FileInfo),
}
fs["/static/js"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
fs["/static/js/config.js"].(os.FileInfo),
fs["/static/js/targets.js"].(os.FileInfo),
}
fs["/static/vendor"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
Expand Down Expand Up @@ -576,6 +599,7 @@ var Assets = func() http.FileSystem {
}
fs["/templates"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
fs["/templates/_base.html"].(os.FileInfo),
fs["/templates/config.html"].(os.FileInfo),
fs["/templates/service-discovery.html"].(os.FileInfo),
fs["/templates/targets.html"].(os.FileInfo),
}
Expand Down
14 changes: 14 additions & 0 deletions clients/pkg/promtail/server/ui/static/css/config.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.btn {
border-radius: 0;
}

#config_yaml {
display: block;
padding: 9.5px;
font-size: 13px;
color:#333;
word-break: break-all;
background-color: #f5f5f5;
border: 1px solid #ccc;
border-radius: 4px;
}
12 changes: 12 additions & 0 deletions clients/pkg/promtail/server/ui/static/js/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function init() {
$("#copyToClipboard").on("click", function () {
var range = document.createRange();
range.selectNode(document.getElementById("config_yaml"));
window.getSelection().empty();
window.getSelection().addRange(range);
document.execCommand("copy");
window.getSelection().empty();
});
}

$(init);
1 change: 1 addition & 0 deletions clients/pkg/promtail/server/ui/templates/_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
<ul class="navbar-nav">
<li class="nav-item"><a class="nav-link" href="{{ pathPrefix }}/service-discovery">Service Discovery</a></li>
<li class="nav-item"><a class="nav-link" href="{{ pathPrefix }}/targets">Targets</a></li>
<li class="nav-item"><a class="nav-link" href="{{ pathPrefix }}/config">Config</a></li>
<li class= "nav-item" >
<a class ="nav-link" href="https://github.com/grafana/loki" target="_blank">Help</a>
</li>
Expand Down
12 changes: 12 additions & 0 deletions clients/pkg/promtail/server/ui/templates/config.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{define "head"}}
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/css/config.css?v={{ buildVersion }}">
<script src="{{ pathPrefix }}/static/js/config.js?v={{ buildVersion }}"></script>
{{end}}

{{define "content"}}
<div class="container-fluid">
<h2 id="configuration">Configuration <button type="button" class="btn btn-primary" id="copyToClipboard">Copy to clipboard</button></h2>

<pre id="config_yaml">{{.}}</pre>
</div>
{{end}}