Skip to content

Commit

Permalink
Removed loki.write and added forward_to argument
Browse files Browse the repository at this point in the history
  • Loading branch information
bentonam committed Oct 3, 2023
1 parent 033f32a commit 6e3baba
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 111 deletions.
62 changes: 6 additions & 56 deletions modules/kubernetes/logs/all.river
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,9 @@
Module: log-all
Description: Wrapper module to include all kubernetes logging modules and use cri parsing
*/

argument "loki_url" {
// comment = "The full URL address of Loki including the protocol, host and path i.e. https://example.com/loki/api/v1/push"
optional = false
}

argument "loki_username" {
// comment = "The Loki Username / Tenant ID"
optional = false
}

argument "loki_password" {
// comment = "The Loki Password / Token for the Tenant"
optional = true
default = ""
argument "forward_to" {
// comment = "Must be a list(LogsReceiver) where collected logs should be forwarded to"
optional = false
}

argument "tenant" {
Expand All @@ -25,24 +13,6 @@ argument "tenant" {
default = ".*"
}

argument "label_cluster" {
// comment = "Static cluster label to add to all collected metrics"
optional = true
default = ""
}

argument "label_env" {
// comment = "Static env label to add to all collected metrics"
optional = true
default = ""
}

argument "label_region" {
// comment = "Static region label to add to all collected metrics"
optional = true
default = ""
}

argument "keep_labels" {
// comment = "List of labels to keep before the log message is written to Loki"
optional = true
Expand Down Expand Up @@ -77,12 +47,9 @@ argument "git_rev" {
}

argument "git_pull_freq" {
// comment = "How often to pull the git repo, the default is 0s which means never pull"
optional = true
default = "5m"
}

export "loki_remote" {
value = loki.write.destination
default = "0s"
}

module.git "log_targets" {
Expand Down Expand Up @@ -196,24 +163,7 @@ module.git "label_keep" {
path = "modules/kubernetes/logs/labels/keep-labels.river"

arguments {
forward_to = loki.write.destination.receiver
forward_to = argument.forward_to.value
keep_labels = argument.keep_labels.value
}
}

loki.write "destination" {
endpoint {
url = argument.loki_url.value

basic_auth {
username = argument.loki_username.value
password = argument.loki_password.value
}
}

external_labels = {
"cluster" = argument.label_cluster.value,
"env" = argument.label_env.value,
"region" = argument.label_region.value,
}
}
59 changes: 4 additions & 55 deletions modules/kubernetes/logs/events.river
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,9 @@ Description: Retrieves and processes kubernetes events. This module should only
a single replica. As events are captured from API calls, any more than a single pod would result in duplicate
events being sent to Loki.
*/

argument "loki_url" {
// comment = "The full URL address of Loki including the protocol, host and path i.e. https://example.com/loki/api/v1/push"
optional = false
}

argument "loki_username" {
// comment = "The Loki Username / Tenant ID"
optional = false
}

argument "loki_password" {
// comment = "The Loki Password / Token for the Tenant"
optional = true
default = ""
argument "forward_to" {
// comment = "Must be a list(LogsReceiver) where collected logs should be forwarded to"
optional = false
}

argument "namespaces" {
Expand All @@ -33,24 +21,6 @@ argument "label_job" {
default = "integrations/kubernetes/eventhandler"
}

argument "label_cluster" {
// comment = "Static cluster label to add to all collected metrics"
optional = true
default = ""
}

argument "label_env" {
// comment = "Static env label to add to all collected metrics"
optional = true
default = ""
}

argument "label_region" {
// comment = "Static region label to add to all collected metrics"
optional = true
default = ""
}

argument "keep_labels" {
// comment = "List of labels to keep before the log message is written to Loki"
optional = true
Expand Down Expand Up @@ -96,10 +66,6 @@ argument "git_pull_freq" {
default = "5m"
}

export "loki_remote" {
value = loki.write.destination
}

loki.source.kubernetes_events "events" {
job_name = argument.label_job.value
namespaces = argument.namespaces.value
Expand Down Expand Up @@ -237,24 +203,7 @@ module.git "label_keep" {
path = "modules/kubernetes/logs/labels/keep-labels.river"

arguments {
forward_to = loki.write.destination.receiver
forward_to = [argument.forward_to.value]
keep_labels = argument.keep_labels.value
}
}

loki.write "destination" {
endpoint {
url = argument.loki_url.value

basic_auth {
username = argument.loki_username.value
password = argument.loki_password.value
}
}

external_labels = {
"cluster" = argument.label_cluster.value,
"env" = argument.label_env.value,
"region" = argument.label_region.value,
}
}

0 comments on commit 6e3baba

Please sign in to comment.