-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LOG-4943: Enhance Infrastructure permissions to support application l…
…og collection
- Loading branch information
Showing
11 changed files
with
491 additions
and
57 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
78 changes: 78 additions & 0 deletions
78
internal/generator/vector/input/viaq_application_with_infra_includes_excludes.toml
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,78 @@ | ||
# Logs from containers (including openshift containers) | ||
[sources.input_my_app_container] | ||
type = "kubernetes_logs" | ||
max_read_bytes = 3145728 | ||
glob_minimum_cooldown_ms = 15000 | ||
auto_partial_merge = true | ||
include_paths_glob_patterns = ["/var/log/pods/test-ns-foo_*/*/*.log", "/var/log/pods/openshift-logging_*/*/*.log", "/var/log/pods/kube-apiserver_*/*/*.log"] | ||
exclude_paths_glob_patterns = ["/var/log/pods/default_*/*/*.log", "/var/log/pods/test-ns1_*/*/*.log", "/var/log/pods/*/*/*.gz", "/var/log/pods/*/*/*.tmp"] | ||
pod_annotation_fields.pod_labels = "kubernetes.labels" | ||
pod_annotation_fields.pod_namespace = "kubernetes.namespace_name" | ||
pod_annotation_fields.pod_annotations = "kubernetes.annotations" | ||
pod_annotation_fields.pod_uid = "kubernetes.pod_id" | ||
pod_annotation_fields.pod_node_name = "hostname" | ||
namespace_annotation_fields.namespace_uid = "kubernetes.namespace_id" | ||
rotate_wait_ms = 5000 | ||
|
||
[transforms.input_my_app_container_viaq] | ||
type = "remap" | ||
inputs = ["input_my_app_container"] | ||
source = ''' | ||
.openshift.cluster_id = "${OPENSHIFT_CLUSTER_ID:-}" | ||
if !exists(.level) { | ||
.level = "default" | ||
if match!(.message, r'Warning|WARN|^W[0-9]+|level=warn|Value:warn|"level":"warn"|<warn>') { | ||
.level = "warn" | ||
} else if match!(.message, r'Error|ERROR|^E[0-9]+|level=error|Value:error|"level":"error"|<error>') { | ||
.level = "error" | ||
} else if match!(.message, r'Critical|CRITICAL|^C[0-9]+|level=critical|Value:critical|"level":"critical"|<critical>') { | ||
.level = "critical" | ||
} else if match!(.message, r'Debug|DEBUG|^D[0-9]+|level=debug|Value:debug|"level":"debug"|<debug>') { | ||
.level = "debug" | ||
} else if match!(.message, r'Notice|NOTICE|^N[0-9]+|level=notice|Value:notice|"level":"notice"|<notice>') { | ||
.level = "notice" | ||
} else if match!(.message, r'Alert|ALERT|^A[0-9]+|level=alert|Value:alert|"level":"alert"|<alert>') { | ||
.level = "alert" | ||
} else if match!(.message, r'Emergency|EMERGENCY|^EM[0-9]+|level=emergency|Value:emergency|"level":"emergency"|<emergency>') { | ||
.level = "emergency" | ||
} else if match!(.message, r'(?i)\b(?:info)\b|^I[0-9]+|level=info|Value:info|"level":"info"|<info>') { | ||
.level = "info" | ||
} | ||
} | ||
pod_name = string!(.kubernetes.pod_name) | ||
if starts_with(pod_name, "eventrouter-") { | ||
parsed, err = parse_json(.message) | ||
if err != null { | ||
log("Unable to process EventRouter log: " + err, level: "info") | ||
} else { | ||
., err = merge(.,parsed) | ||
if err == null && exists(.event) && is_object(.event) { | ||
if exists(.verb) { | ||
.event.verb = .verb | ||
del(.verb) | ||
} | ||
.kubernetes.event = del(.event) | ||
.message = del(.kubernetes.event.message) | ||
set!(., ["@timestamp"], .kubernetes.event.metadata.creationTimestamp) | ||
del(.kubernetes.event.metadata.creationTimestamp) | ||
. = compact(., nullish: true) | ||
} else { | ||
log("Unable to merge EventRouter log message into record: " + err, level: "info") | ||
} | ||
} | ||
} | ||
del(.source_type) | ||
del(.stream) | ||
del(.kubernetes.pod_ips) | ||
del(.kubernetes.node_labels) | ||
del(.timestamp_end) | ||
ts = del(.timestamp); if !exists(."@timestamp") {."@timestamp" = ts} | ||
''' | ||
|
||
# Set log_type | ||
[transforms.input_my_app_viaq_logtype] | ||
type = "remap" | ||
inputs = ["input_my_app_container_viaq"] | ||
source = ''' | ||
.log_type = "application" | ||
''' |
78 changes: 78 additions & 0 deletions
78
internal/generator/vector/input/viaq_application_with_infra_includes_infra_excludes.toml
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,78 @@ | ||
# Logs from containers (including openshift containers) | ||
[sources.input_my_app_container] | ||
type = "kubernetes_logs" | ||
max_read_bytes = 3145728 | ||
glob_minimum_cooldown_ms = 15000 | ||
auto_partial_merge = true | ||
include_paths_glob_patterns = ["/var/log/pods/test-ns-foo_*/*/*.log", "/var/log/pods/openshift*_*/*/*.log", "/var/log/pods/kube-apiserver_*/*/*.log"] | ||
exclude_paths_glob_patterns = ["/var/log/pods/default_*/*/*.log", "/var/log/pods/openshift-logging_*/*/*.log", "/var/log/pods/test-ns1_*/*/*.log", "/var/log/pods/*/*/*.gz", "/var/log/pods/*/*/*.tmp"] | ||
pod_annotation_fields.pod_labels = "kubernetes.labels" | ||
pod_annotation_fields.pod_namespace = "kubernetes.namespace_name" | ||
pod_annotation_fields.pod_annotations = "kubernetes.annotations" | ||
pod_annotation_fields.pod_uid = "kubernetes.pod_id" | ||
pod_annotation_fields.pod_node_name = "hostname" | ||
namespace_annotation_fields.namespace_uid = "kubernetes.namespace_id" | ||
rotate_wait_ms = 5000 | ||
|
||
[transforms.input_my_app_container_viaq] | ||
type = "remap" | ||
inputs = ["input_my_app_container"] | ||
source = ''' | ||
.openshift.cluster_id = "${OPENSHIFT_CLUSTER_ID:-}" | ||
if !exists(.level) { | ||
.level = "default" | ||
if match!(.message, r'Warning|WARN|^W[0-9]+|level=warn|Value:warn|"level":"warn"|<warn>') { | ||
.level = "warn" | ||
} else if match!(.message, r'Error|ERROR|^E[0-9]+|level=error|Value:error|"level":"error"|<error>') { | ||
.level = "error" | ||
} else if match!(.message, r'Critical|CRITICAL|^C[0-9]+|level=critical|Value:critical|"level":"critical"|<critical>') { | ||
.level = "critical" | ||
} else if match!(.message, r'Debug|DEBUG|^D[0-9]+|level=debug|Value:debug|"level":"debug"|<debug>') { | ||
.level = "debug" | ||
} else if match!(.message, r'Notice|NOTICE|^N[0-9]+|level=notice|Value:notice|"level":"notice"|<notice>') { | ||
.level = "notice" | ||
} else if match!(.message, r'Alert|ALERT|^A[0-9]+|level=alert|Value:alert|"level":"alert"|<alert>') { | ||
.level = "alert" | ||
} else if match!(.message, r'Emergency|EMERGENCY|^EM[0-9]+|level=emergency|Value:emergency|"level":"emergency"|<emergency>') { | ||
.level = "emergency" | ||
} else if match!(.message, r'(?i)\b(?:info)\b|^I[0-9]+|level=info|Value:info|"level":"info"|<info>') { | ||
.level = "info" | ||
} | ||
} | ||
pod_name = string!(.kubernetes.pod_name) | ||
if starts_with(pod_name, "eventrouter-") { | ||
parsed, err = parse_json(.message) | ||
if err != null { | ||
log("Unable to process EventRouter log: " + err, level: "info") | ||
} else { | ||
., err = merge(.,parsed) | ||
if err == null && exists(.event) && is_object(.event) { | ||
if exists(.verb) { | ||
.event.verb = .verb | ||
del(.verb) | ||
} | ||
.kubernetes.event = del(.event) | ||
.message = del(.kubernetes.event.message) | ||
set!(., ["@timestamp"], .kubernetes.event.metadata.creationTimestamp) | ||
del(.kubernetes.event.metadata.creationTimestamp) | ||
. = compact(., nullish: true) | ||
} else { | ||
log("Unable to merge EventRouter log message into record: " + err, level: "info") | ||
} | ||
} | ||
} | ||
del(.source_type) | ||
del(.stream) | ||
del(.kubernetes.pod_ips) | ||
del(.kubernetes.node_labels) | ||
del(.timestamp_end) | ||
ts = del(.timestamp); if !exists(."@timestamp") {."@timestamp" = ts} | ||
''' | ||
|
||
# Set log_type | ||
[transforms.input_my_app_viaq_logtype] | ||
type = "remap" | ||
inputs = ["input_my_app_container_viaq"] | ||
source = ''' | ||
.log_type = "application" | ||
''' |
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
78 changes: 78 additions & 0 deletions
78
.../generator/vector/input/viaq_application_with_specific_infra_includes_infra_excludes.toml
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,78 @@ | ||
# Logs from containers (including openshift containers) | ||
[sources.input_my_app_container] | ||
type = "kubernetes_logs" | ||
max_read_bytes = 3145728 | ||
glob_minimum_cooldown_ms = 15000 | ||
auto_partial_merge = true | ||
include_paths_glob_patterns = ["/var/log/pods/test-ns-foo_*/*/*.log", "/var/log/pods/openshift-logging_*/*/*.log", "/var/log/pods/kube-apiserver_*/*/*.log"] | ||
exclude_paths_glob_patterns = ["/var/log/pods/default_*/*/*.log", "/var/log/pods/openshift*_*/*/*.log", "/var/log/pods/test-ns1_*/*/*.log", "/var/log/pods/*/*/*.gz", "/var/log/pods/*/*/*.tmp"] | ||
pod_annotation_fields.pod_labels = "kubernetes.labels" | ||
pod_annotation_fields.pod_namespace = "kubernetes.namespace_name" | ||
pod_annotation_fields.pod_annotations = "kubernetes.annotations" | ||
pod_annotation_fields.pod_uid = "kubernetes.pod_id" | ||
pod_annotation_fields.pod_node_name = "hostname" | ||
namespace_annotation_fields.namespace_uid = "kubernetes.namespace_id" | ||
rotate_wait_ms = 5000 | ||
|
||
[transforms.input_my_app_container_viaq] | ||
type = "remap" | ||
inputs = ["input_my_app_container"] | ||
source = ''' | ||
.openshift.cluster_id = "${OPENSHIFT_CLUSTER_ID:-}" | ||
if !exists(.level) { | ||
.level = "default" | ||
if match!(.message, r'Warning|WARN|^W[0-9]+|level=warn|Value:warn|"level":"warn"|<warn>') { | ||
.level = "warn" | ||
} else if match!(.message, r'Error|ERROR|^E[0-9]+|level=error|Value:error|"level":"error"|<error>') { | ||
.level = "error" | ||
} else if match!(.message, r'Critical|CRITICAL|^C[0-9]+|level=critical|Value:critical|"level":"critical"|<critical>') { | ||
.level = "critical" | ||
} else if match!(.message, r'Debug|DEBUG|^D[0-9]+|level=debug|Value:debug|"level":"debug"|<debug>') { | ||
.level = "debug" | ||
} else if match!(.message, r'Notice|NOTICE|^N[0-9]+|level=notice|Value:notice|"level":"notice"|<notice>') { | ||
.level = "notice" | ||
} else if match!(.message, r'Alert|ALERT|^A[0-9]+|level=alert|Value:alert|"level":"alert"|<alert>') { | ||
.level = "alert" | ||
} else if match!(.message, r'Emergency|EMERGENCY|^EM[0-9]+|level=emergency|Value:emergency|"level":"emergency"|<emergency>') { | ||
.level = "emergency" | ||
} else if match!(.message, r'(?i)\b(?:info)\b|^I[0-9]+|level=info|Value:info|"level":"info"|<info>') { | ||
.level = "info" | ||
} | ||
} | ||
pod_name = string!(.kubernetes.pod_name) | ||
if starts_with(pod_name, "eventrouter-") { | ||
parsed, err = parse_json(.message) | ||
if err != null { | ||
log("Unable to process EventRouter log: " + err, level: "info") | ||
} else { | ||
., err = merge(.,parsed) | ||
if err == null && exists(.event) && is_object(.event) { | ||
if exists(.verb) { | ||
.event.verb = .verb | ||
del(.verb) | ||
} | ||
.kubernetes.event = del(.event) | ||
.message = del(.kubernetes.event.message) | ||
set!(., ["@timestamp"], .kubernetes.event.metadata.creationTimestamp) | ||
del(.kubernetes.event.metadata.creationTimestamp) | ||
. = compact(., nullish: true) | ||
} else { | ||
log("Unable to merge EventRouter log message into record: " + err, level: "info") | ||
} | ||
} | ||
} | ||
del(.source_type) | ||
del(.stream) | ||
del(.kubernetes.pod_ips) | ||
del(.kubernetes.node_labels) | ||
del(.timestamp_end) | ||
ts = del(.timestamp); if !exists(."@timestamp") {."@timestamp" = ts} | ||
''' | ||
|
||
# Set log_type | ||
[transforms.input_my_app_viaq_logtype] | ||
type = "remap" | ||
inputs = ["input_my_app_container_viaq"] | ||
source = ''' | ||
.log_type = "application" | ||
''' |
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
Oops, something went wrong.