-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
499 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM ubuntu:22.04 | ||
WORKDIR /app | ||
COPY nomad-vector-logger.bin . | ||
COPY config.sample.toml . | ||
CMD ["./nomad-vector-logger.bin"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
[app] | ||
log_level = "debug" # `debug` for verbose logs. `info` otherwise. | ||
env = "dev" # dev|prod. | ||
refresh_interval = "10s" # Interval at which `index.json` gets stored in `data_dir`. | ||
nomad_data_dir = "/opt/nomad/data/alloc" # Nomad data directory where allocs are stored. | ||
refresh_interval = "10s" # Interval at which list of allocations is updated. | ||
remove_alloc_interval = "30s" # If the alloc is completed or stopped, the allocation isn't removed immediately from vector's config. You can delay the removal of alloc by `n` duration to ensure that vector has finished collecting all logs till then. | ||
nomad_data_dir = "/opt/nomad/data/alloc" # Nomad data directory where alloc logs are stored. | ||
vector_config_dir = "examples/vector/" # Path to the generated vector config file. | ||
extra_templates_dir = "static/" # Extra templates that can be given. They will be rendered in `$vector_config_dir`. You can use variables mentioned in vector.tmpl if required. | ||
|
||
[stream] | ||
max_reconnect_attempts = 5 # Maximum reconnection attempts with Nomad Events API. After this limit is breached, program exits. | ||
extra_templates_dir = "static/" # Extra templates that can be given. They will be rendered in directory mentioned by `vector_config_dir`. You can use variables mentioned in vector.toml.tmpl if required. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
.PHONY: vector | ||
vector: | ||
vector --config=base.toml --config-dir=vector/ --watch-config vector/ | ||
vector --watch-config --config=base.toml --config-dir=vector/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
[sources.source_nomad_alloc_a0717c55-b2a2-8c90-1a39-b875a95d5a1a_server] | ||
type = "file" | ||
include = [ "/opt/nomad/data/alloc/a0717c55-b2a2-8c90-1a39-b875a95d5a1a/alloc/logs/server*" ] | ||
line_delimiter = "\n" | ||
read_from = "beginning" | ||
[transforms.transform_nomad_alloc_a0717c55-b2a2-8c90-1a39-b875a95d5a1a_server] | ||
type = "remap" | ||
inputs = ["source_nomad_alloc_a0717c55-b2a2-8c90-1a39-b875a95d5a1a_server"] | ||
source = ''' | ||
# Store Nomad metadata. | ||
.nomad.namespace = "default" | ||
.nomad.node_name = "pop-os" | ||
.nomad.job_name = "http" | ||
.nomad.group_name = "app" | ||
.nomad.task_name = "server" | ||
.nomad.alloc_id = "a0717c55-b2a2-8c90-1a39-b875a95d5a1a" | ||
''' | ||
[sources.source_nomad_alloc_8056b311-d9d9-28b3-1a60-1a7e71420e46_server] | ||
type = "file" | ||
include = [ "/opt/nomad/data/alloc/8056b311-d9d9-28b3-1a60-1a7e71420e46/alloc/logs/server*" ] | ||
line_delimiter = "\n" | ||
read_from = "beginning" | ||
[transforms.transform_nomad_alloc_8056b311-d9d9-28b3-1a60-1a7e71420e46_server] | ||
type = "remap" | ||
inputs = ["source_nomad_alloc_8056b311-d9d9-28b3-1a60-1a7e71420e46_server"] | ||
source = ''' | ||
# Store Nomad metadata. | ||
.nomad.namespace = "default" | ||
.nomad.node_name = "pop-os" | ||
.nomad.job_name = "http" | ||
.nomad.group_name = "app" | ||
.nomad.task_name = "server" | ||
.nomad.alloc_id = "8056b311-d9d9-28b3-1a60-1a7e71420e46" | ||
''' | ||
[sources.source_nomad_alloc_5fc6ee1a-fcfa-9a34-a70b-44f5ba627f35_server] | ||
type = "file" | ||
include = [ "/opt/nomad/data/alloc/5fc6ee1a-fcfa-9a34-a70b-44f5ba627f35/alloc/logs/server*" ] | ||
line_delimiter = "\n" | ||
read_from = "beginning" | ||
[transforms.transform_nomad_alloc_5fc6ee1a-fcfa-9a34-a70b-44f5ba627f35_server] | ||
type = "remap" | ||
inputs = ["source_nomad_alloc_5fc6ee1a-fcfa-9a34-a70b-44f5ba627f35_server"] | ||
source = ''' | ||
# Store Nomad metadata. | ||
.nomad.namespace = "default" | ||
.nomad.node_name = "pop-os" | ||
.nomad.job_name = "http" | ||
.nomad.group_name = "app" | ||
.nomad.task_name = "server" | ||
.nomad.alloc_id = "5fc6ee1a-fcfa-9a34-a70b-44f5ba627f35" | ||
''' | ||
[sources.source_nomad_alloc_1b139a2a-ada0-0b7f-b0ef-7390ffc55e56_server] | ||
type = "file" | ||
include = [ "/opt/nomad/data/alloc/1b139a2a-ada0-0b7f-b0ef-7390ffc55e56/alloc/logs/server*" ] | ||
line_delimiter = "\n" | ||
read_from = "beginning" | ||
[transforms.transform_nomad_alloc_1b139a2a-ada0-0b7f-b0ef-7390ffc55e56_server] | ||
type = "remap" | ||
inputs = ["source_nomad_alloc_1b139a2a-ada0-0b7f-b0ef-7390ffc55e56_server"] | ||
source = ''' | ||
# Store Nomad metadata. | ||
.nomad.namespace = "default" | ||
.nomad.node_name = "pop-os" | ||
.nomad.job_name = "http" | ||
.nomad.group_name = "app" | ||
.nomad.task_name = "server" | ||
.nomad.alloc_id = "1b139a2a-ada0-0b7f-b0ef-7390ffc55e56" | ||
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[sinks.stdout_nomad] | ||
type = "console" | ||
inputs = ["transform_nomad_alloc*"] | ||
target = "stdout" | ||
|
||
[sinks.stdout_nomad.encoding] | ||
codec = "json" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,24 @@ | ||
module github.com/mr-karan/nomad-vector-logger | ||
|
||
go 1.18 | ||
go 1.19 | ||
|
||
require ( | ||
github.com/hashicorp/nomad/api v0.0.0-20211103234928-04cab9dbecd3 | ||
github.com/knadh/koanf v1.4.1 | ||
github.com/mr-karan/nomad-events-sink v0.2.0 | ||
github.com/hashicorp/nomad/api v0.0.0-20220902193006-d33f1eac719c | ||
github.com/knadh/koanf v1.4.3 | ||
github.com/spf13/pflag v1.0.5 | ||
github.com/zerodha/logf v0.5.5 | ||
) | ||
|
||
require ( | ||
github.com/fsnotify/fsnotify v1.4.9 // indirect | ||
github.com/gorilla/websocket v1.4.1 // indirect | ||
github.com/hashicorp/cronexpr v1.1.0 // indirect | ||
github.com/hashicorp/go-cleanhttp v0.5.1 // indirect | ||
github.com/fsnotify/fsnotify v1.5.4 // indirect | ||
github.com/gorilla/websocket v1.5.0 // indirect | ||
github.com/hashicorp/cronexpr v1.1.1 // indirect | ||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect | ||
github.com/hashicorp/go-rootcerts v1.0.2 // indirect | ||
github.com/mitchellh/copystructure v1.2.0 // indirect | ||
github.com/mitchellh/go-homedir v1.1.0 // indirect | ||
github.com/mitchellh/mapstructure v1.4.1 // indirect | ||
github.com/mitchellh/mapstructure v1.5.0 // indirect | ||
github.com/mitchellh/reflectwalk v1.0.2 // indirect | ||
github.com/pelletier/go-toml v1.7.0 // indirect | ||
golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect | ||
github.com/pelletier/go-toml v1.9.5 // indirect | ||
golang.org/x/sys v0.0.0-20220829200755-d48e67d00261 // indirect | ||
) |
Oops, something went wrong.