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

Simplify regexp's #1202

Merged
merged 1 commit into from
Oct 28, 2019
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
2 changes: 1 addition & 1 deletion docs/clients/promtail/scraping.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ value or transformed to a final external label, such as `__job__`.
* Drop the target if a label (`__service__` in the example) is empty:
```yaml
- action: drop
regex: ^$
regex: ''
source_labels:
- __service__
```
Expand Down
18 changes: 9 additions & 9 deletions production/helm/promtail/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ data:
- __meta_kubernetes_pod_node_name
target_label: __host__
- action: drop
regex: ^$
regex: ''
source_labels:
- __service__
- action: labelmap
Expand Down Expand Up @@ -75,7 +75,7 @@ data:
- __meta_kubernetes_pod_node_name
target_label: __host__
- action: drop
regex: ^$
regex: ''
source_labels:
- __service__
- action: labelmap
Expand Down Expand Up @@ -118,7 +118,7 @@ data:
- __meta_kubernetes_pod_label_name
- __meta_kubernetes_pod_label_app
- action: drop
regex: ^([0-9a-z-.]+)(-[0-9a-f]{8,10})$
regex: '[0-9a-z-.]+-[0-9a-f]{8,10}'
source_labels:
- __meta_kubernetes_pod_controller_name
- source_labels:
Expand All @@ -128,7 +128,7 @@ data:
- __meta_kubernetes_pod_node_name
target_label: __host__
- action: drop
regex: ^$
regex: ''
source_labels:
- __service__
- action: labelmap
Expand Down Expand Up @@ -171,19 +171,19 @@ data:
- __meta_kubernetes_pod_label_name
- __meta_kubernetes_pod_label_app
- action: keep
regex: ^([0-9a-z-.]+)(-[0-9a-f]{8,10})$
regex: '[0-9a-z-.]+-[0-9a-f]{8,10}'
source_labels:
- __meta_kubernetes_pod_controller_name
- action: replace
regex: ^([0-9a-z-.]+)(-[0-9a-f]{8,10})$
regex: '([0-9a-z-.]+)-[0-9a-f]{8,10}'
source_labels:
- __meta_kubernetes_pod_controller_name
target_label: __service__
- source_labels:
- __meta_kubernetes_pod_node_name
target_label: __host__
- action: drop
regex: ^$
regex: ''
source_labels:
- __service__
- action: labelmap
Expand Down Expand Up @@ -220,7 +220,7 @@ data:
- role: pod
relabel_configs:
- action: drop
regex: ^$
regex: ''
source_labels:
- __meta_kubernetes_pod_annotation_kubernetes_io_config_mirror
- action: replace
Expand All @@ -231,7 +231,7 @@ data:
- __meta_kubernetes_pod_node_name
target_label: __host__
- action: drop
regex: ^$
regex: ''
source_labels:
- __service__
- action: labelmap
Expand Down
12 changes: 6 additions & 6 deletions production/ksonnet/promtail/scrape_config.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ config + {
{
source_labels: ['__service__'],
action: 'drop',
regex: '^$',
regex: '',
},

// Include all the other labels on the pod.
Expand Down Expand Up @@ -122,7 +122,7 @@ config + {
{
source_labels: ['__meta_kubernetes_pod_controller_name'],
action: 'drop',
regex: '^([0-9a-z-.]+)(-[0-9a-f]{8,10})$',
regex: '[0-9a-z-.]+-[0-9a-f]{8,10}',
},

// Use controller name as __service__.
Expand All @@ -149,15 +149,15 @@ config + {
// Drop pods not from an indirect controller. eg StatefulSets, DaemonSets
{
source_labels: ['__meta_kubernetes_pod_controller_name'],
regex: '^([0-9a-z-.]+)(-[0-9a-f]{8,10})$',
regex: '[0-9a-z-.]+-[0-9a-f]{8,10}',
action: 'keep',
},

// put the indirect controller name into a temp label.
// Put the indirect controller name into a temp label.
{
source_labels: ['__meta_kubernetes_pod_controller_name'],
action: 'replace',
regex: '^([0-9a-z-.]+)(-[0-9a-f]{8,10})$',
regex: '([0-9a-z-.]+)-[0-9a-f]{8,10}',
target_label: '__service__',
},
]
Expand All @@ -171,7 +171,7 @@ config + {
{
action: 'drop',
source_labels: ['__meta_kubernetes_pod_annotation_kubernetes_io_config_mirror'],
regex: '^$',
regex: '',
},

// Static control plane pods usually have a component label that identifies them
Expand Down