Skip to content

Commit 90fe9c4

Browse files
authored
Merge pull request #110 from gdashboard/cloudwatch-logs
Support CloudWatch Logs queries
2 parents 9dcbbee + f5ac1e5 commit 90fe9c4

File tree

11 files changed

+569
-133
lines changed

11 files changed

+569
-133
lines changed

docs/data-sources/bar_gauge.md

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,41 @@ Optional:
813813
<a id="nestedblock--queries--cloudwatch"></a>
814814
### Nested Schema for `queries.cloudwatch`
815815

816+
Optional:
817+
818+
- `logs` (Block List) The logs query. (see [below for nested schema](#nestedblock--queries--cloudwatch--logs))
819+
- `metrics` (Block List) The metrics query. (see [below for nested schema](#nestedblock--queries--cloudwatch--metrics))
820+
821+
<a id="nestedblock--queries--cloudwatch--logs"></a>
822+
### Nested Schema for `queries.cloudwatch.logs`
823+
824+
Required:
825+
826+
- `expression` (String) The expression to use to query the logs.
827+
- `uid` (String) The UID of a CloudWatch DataSource to use in this query.
828+
829+
Optional:
830+
831+
- `log_group` (Block List) The log group to query logs from. (see [below for nested schema](#nestedblock--queries--cloudwatch--logs--log_group))
832+
- `ref_id` (String) The ID of the query. The ID can be used to reference queries in math expressions.
833+
- `region` (String) The AWS region to query the logs from.
834+
835+
<a id="nestedblock--queries--cloudwatch--logs--log_group"></a>
836+
### Nested Schema for `queries.cloudwatch.logs.log_group`
837+
838+
Required:
839+
840+
- `arn` (String) The ARN of the log group to query logs from.
841+
842+
Optional:
843+
844+
- `name` (String) The name of log group to show in the query builder.
845+
846+
847+
848+
<a id="nestedblock--queries--cloudwatch--metrics"></a>
849+
### Nested Schema for `queries.cloudwatch.metrics`
850+
816851
Required:
817852

818853
- `metric_name` (String) The name of the metric to query. Example: `CPUUtilization`
@@ -822,15 +857,15 @@ Required:
822857

823858
Optional:
824859

825-
- `dimension` (Block List) The dimension to filter the metric with. (see [below for nested schema](#nestedblock--queries--cloudwatch--dimension))
860+
- `dimension` (Block List) The dimension to filter the metric with. (see [below for nested schema](#nestedblock--queries--cloudwatch--metrics--dimension))
826861
- `label` (String) The legend name.
827862
- `match_exact` (Boolean) If enabled you also need to specify **all** the dimensions of the metric you’re querying.
828863
- `period` (String) The minimum interval between points in seconds.
829864
- `ref_id` (String) The ID of the query. The ID can be used to reference queries in math expressions.
830865
- `region` (String) The AWS region to query the metrics from.
831866

832-
<a id="nestedblock--queries--cloudwatch--dimension"></a>
833-
### Nested Schema for `queries.cloudwatch.dimension`
867+
<a id="nestedblock--queries--cloudwatch--metrics--dimension"></a>
868+
### Nested Schema for `queries.cloudwatch.metrics.dimension`
834869

835870
Required:
836871

@@ -839,6 +874,7 @@ Required:
839874

840875

841876

877+
842878
<a id="nestedblock--queries--prometheus"></a>
843879
### Nested Schema for `queries.prometheus`
844880

docs/data-sources/gauge.md

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,41 @@ Optional:
851851
<a id="nestedblock--queries--cloudwatch"></a>
852852
### Nested Schema for `queries.cloudwatch`
853853

854+
Optional:
855+
856+
- `logs` (Block List) The logs query. (see [below for nested schema](#nestedblock--queries--cloudwatch--logs))
857+
- `metrics` (Block List) The metrics query. (see [below for nested schema](#nestedblock--queries--cloudwatch--metrics))
858+
859+
<a id="nestedblock--queries--cloudwatch--logs"></a>
860+
### Nested Schema for `queries.cloudwatch.logs`
861+
862+
Required:
863+
864+
- `expression` (String) The expression to use to query the logs.
865+
- `uid` (String) The UID of a CloudWatch DataSource to use in this query.
866+
867+
Optional:
868+
869+
- `log_group` (Block List) The log group to query logs from. (see [below for nested schema](#nestedblock--queries--cloudwatch--logs--log_group))
870+
- `ref_id` (String) The ID of the query. The ID can be used to reference queries in math expressions.
871+
- `region` (String) The AWS region to query the logs from.
872+
873+
<a id="nestedblock--queries--cloudwatch--logs--log_group"></a>
874+
### Nested Schema for `queries.cloudwatch.logs.log_group`
875+
876+
Required:
877+
878+
- `arn` (String) The ARN of the log group to query logs from.
879+
880+
Optional:
881+
882+
- `name` (String) The name of log group to show in the query builder.
883+
884+
885+
886+
<a id="nestedblock--queries--cloudwatch--metrics"></a>
887+
### Nested Schema for `queries.cloudwatch.metrics`
888+
854889
Required:
855890

856891
- `metric_name` (String) The name of the metric to query. Example: `CPUUtilization`
@@ -860,15 +895,15 @@ Required:
860895

861896
Optional:
862897

863-
- `dimension` (Block List) The dimension to filter the metric with. (see [below for nested schema](#nestedblock--queries--cloudwatch--dimension))
898+
- `dimension` (Block List) The dimension to filter the metric with. (see [below for nested schema](#nestedblock--queries--cloudwatch--metrics--dimension))
864899
- `label` (String) The legend name.
865900
- `match_exact` (Boolean) If enabled you also need to specify **all** the dimensions of the metric you’re querying.
866901
- `period` (String) The minimum interval between points in seconds.
867902
- `ref_id` (String) The ID of the query. The ID can be used to reference queries in math expressions.
868903
- `region` (String) The AWS region to query the metrics from.
869904

870-
<a id="nestedblock--queries--cloudwatch--dimension"></a>
871-
### Nested Schema for `queries.cloudwatch.dimension`
905+
<a id="nestedblock--queries--cloudwatch--metrics--dimension"></a>
906+
### Nested Schema for `queries.cloudwatch.metrics.dimension`
872907

873908
Required:
874909

@@ -877,6 +912,7 @@ Required:
877912

878913

879914

915+
880916
<a id="nestedblock--queries--prometheus"></a>
881917
### Nested Schema for `queries.prometheus`
882918

docs/data-sources/logs.md

Lines changed: 63 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,30 @@ data "gdashboard_logs" "logs" {
2727
order = "oldest_first"
2828
}
2929
30+
queries {
31+
cloudwatch {
32+
logs {
33+
uid = "cloudwatch"
34+
region = "eu-west-2"
35+
36+
expression = <<-EOT
37+
fields @timestamp, @message |
38+
sort @timestamp desc |
39+
limit 20
40+
EOT
41+
42+
log_group {
43+
arn = "arn:aws:logs:eu-west-2:123456789012:log-group:/ecs/production/service-1:*"
44+
name = "/ecs/production/service-1"
45+
}
46+
47+
log_group {
48+
arn = "arn:aws:logs:eu-west-2:123456789012:log-group:/ecs/production/service-2:*"
49+
name = "/ecs/production/service-2"
50+
}
51+
}
52+
}
53+
}
3054
}
3155
```
3256

@@ -75,6 +99,41 @@ Optional:
7599
<a id="nestedblock--queries--cloudwatch"></a>
76100
### Nested Schema for `queries.cloudwatch`
77101

102+
Optional:
103+
104+
- `logs` (Block List) The logs query. (see [below for nested schema](#nestedblock--queries--cloudwatch--logs))
105+
- `metrics` (Block List) The metrics query. (see [below for nested schema](#nestedblock--queries--cloudwatch--metrics))
106+
107+
<a id="nestedblock--queries--cloudwatch--logs"></a>
108+
### Nested Schema for `queries.cloudwatch.logs`
109+
110+
Required:
111+
112+
- `expression` (String) The expression to use to query the logs.
113+
- `uid` (String) The UID of a CloudWatch DataSource to use in this query.
114+
115+
Optional:
116+
117+
- `log_group` (Block List) The log group to query logs from. (see [below for nested schema](#nestedblock--queries--cloudwatch--logs--log_group))
118+
- `ref_id` (String) The ID of the query. The ID can be used to reference queries in math expressions.
119+
- `region` (String) The AWS region to query the logs from.
120+
121+
<a id="nestedblock--queries--cloudwatch--logs--log_group"></a>
122+
### Nested Schema for `queries.cloudwatch.logs.log_group`
123+
124+
Required:
125+
126+
- `arn` (String) The ARN of the log group to query logs from.
127+
128+
Optional:
129+
130+
- `name` (String) The name of log group to show in the query builder.
131+
132+
133+
134+
<a id="nestedblock--queries--cloudwatch--metrics"></a>
135+
### Nested Schema for `queries.cloudwatch.metrics`
136+
78137
Required:
79138

80139
- `metric_name` (String) The name of the metric to query. Example: `CPUUtilization`
@@ -84,15 +143,15 @@ Required:
84143

85144
Optional:
86145

87-
- `dimension` (Block List) The dimension to filter the metric with. (see [below for nested schema](#nestedblock--queries--cloudwatch--dimension))
146+
- `dimension` (Block List) The dimension to filter the metric with. (see [below for nested schema](#nestedblock--queries--cloudwatch--metrics--dimension))
88147
- `label` (String) The legend name.
89148
- `match_exact` (Boolean) If enabled you also need to specify **all** the dimensions of the metric you’re querying.
90149
- `period` (String) The minimum interval between points in seconds.
91150
- `ref_id` (String) The ID of the query. The ID can be used to reference queries in math expressions.
92151
- `region` (String) The AWS region to query the metrics from.
93152

94-
<a id="nestedblock--queries--cloudwatch--dimension"></a>
95-
### Nested Schema for `queries.cloudwatch.dimension`
153+
<a id="nestedblock--queries--cloudwatch--metrics--dimension"></a>
154+
### Nested Schema for `queries.cloudwatch.metrics.dimension`
96155

97156
Required:
98157

@@ -101,6 +160,7 @@ Required:
101160

102161

103162

163+
104164
<a id="nestedblock--queries--prometheus"></a>
105165
### Nested Schema for `queries.prometheus`
106166

docs/data-sources/stat.md

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -848,6 +848,41 @@ Optional:
848848
<a id="nestedblock--queries--cloudwatch"></a>
849849
### Nested Schema for `queries.cloudwatch`
850850

851+
Optional:
852+
853+
- `logs` (Block List) The logs query. (see [below for nested schema](#nestedblock--queries--cloudwatch--logs))
854+
- `metrics` (Block List) The metrics query. (see [below for nested schema](#nestedblock--queries--cloudwatch--metrics))
855+
856+
<a id="nestedblock--queries--cloudwatch--logs"></a>
857+
### Nested Schema for `queries.cloudwatch.logs`
858+
859+
Required:
860+
861+
- `expression` (String) The expression to use to query the logs.
862+
- `uid` (String) The UID of a CloudWatch DataSource to use in this query.
863+
864+
Optional:
865+
866+
- `log_group` (Block List) The log group to query logs from. (see [below for nested schema](#nestedblock--queries--cloudwatch--logs--log_group))
867+
- `ref_id` (String) The ID of the query. The ID can be used to reference queries in math expressions.
868+
- `region` (String) The AWS region to query the logs from.
869+
870+
<a id="nestedblock--queries--cloudwatch--logs--log_group"></a>
871+
### Nested Schema for `queries.cloudwatch.logs.log_group`
872+
873+
Required:
874+
875+
- `arn` (String) The ARN of the log group to query logs from.
876+
877+
Optional:
878+
879+
- `name` (String) The name of log group to show in the query builder.
880+
881+
882+
883+
<a id="nestedblock--queries--cloudwatch--metrics"></a>
884+
### Nested Schema for `queries.cloudwatch.metrics`
885+
851886
Required:
852887

853888
- `metric_name` (String) The name of the metric to query. Example: `CPUUtilization`
@@ -857,15 +892,15 @@ Required:
857892

858893
Optional:
859894

860-
- `dimension` (Block List) The dimension to filter the metric with. (see [below for nested schema](#nestedblock--queries--cloudwatch--dimension))
895+
- `dimension` (Block List) The dimension to filter the metric with. (see [below for nested schema](#nestedblock--queries--cloudwatch--metrics--dimension))
861896
- `label` (String) The legend name.
862897
- `match_exact` (Boolean) If enabled you also need to specify **all** the dimensions of the metric you’re querying.
863898
- `period` (String) The minimum interval between points in seconds.
864899
- `ref_id` (String) The ID of the query. The ID can be used to reference queries in math expressions.
865900
- `region` (String) The AWS region to query the metrics from.
866901

867-
<a id="nestedblock--queries--cloudwatch--dimension"></a>
868-
### Nested Schema for `queries.cloudwatch.dimension`
902+
<a id="nestedblock--queries--cloudwatch--metrics--dimension"></a>
903+
### Nested Schema for `queries.cloudwatch.metrics.dimension`
869904

870905
Required:
871906

@@ -874,6 +909,7 @@ Required:
874909

875910

876911

912+
877913
<a id="nestedblock--queries--prometheus"></a>
878914
### Nested Schema for `queries.prometheus`
879915

docs/data-sources/table.md

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,41 @@ Optional:
883883
<a id="nestedblock--queries--cloudwatch"></a>
884884
### Nested Schema for `queries.cloudwatch`
885885

886+
Optional:
887+
888+
- `logs` (Block List) The logs query. (see [below for nested schema](#nestedblock--queries--cloudwatch--logs))
889+
- `metrics` (Block List) The metrics query. (see [below for nested schema](#nestedblock--queries--cloudwatch--metrics))
890+
891+
<a id="nestedblock--queries--cloudwatch--logs"></a>
892+
### Nested Schema for `queries.cloudwatch.logs`
893+
894+
Required:
895+
896+
- `expression` (String) The expression to use to query the logs.
897+
- `uid` (String) The UID of a CloudWatch DataSource to use in this query.
898+
899+
Optional:
900+
901+
- `log_group` (Block List) The log group to query logs from. (see [below for nested schema](#nestedblock--queries--cloudwatch--logs--log_group))
902+
- `ref_id` (String) The ID of the query. The ID can be used to reference queries in math expressions.
903+
- `region` (String) The AWS region to query the logs from.
904+
905+
<a id="nestedblock--queries--cloudwatch--logs--log_group"></a>
906+
### Nested Schema for `queries.cloudwatch.logs.log_group`
907+
908+
Required:
909+
910+
- `arn` (String) The ARN of the log group to query logs from.
911+
912+
Optional:
913+
914+
- `name` (String) The name of log group to show in the query builder.
915+
916+
917+
918+
<a id="nestedblock--queries--cloudwatch--metrics"></a>
919+
### Nested Schema for `queries.cloudwatch.metrics`
920+
886921
Required:
887922

888923
- `metric_name` (String) The name of the metric to query. Example: `CPUUtilization`
@@ -892,15 +927,15 @@ Required:
892927

893928
Optional:
894929

895-
- `dimension` (Block List) The dimension to filter the metric with. (see [below for nested schema](#nestedblock--queries--cloudwatch--dimension))
930+
- `dimension` (Block List) The dimension to filter the metric with. (see [below for nested schema](#nestedblock--queries--cloudwatch--metrics--dimension))
896931
- `label` (String) The legend name.
897932
- `match_exact` (Boolean) If enabled you also need to specify **all** the dimensions of the metric you’re querying.
898933
- `period` (String) The minimum interval between points in seconds.
899934
- `ref_id` (String) The ID of the query. The ID can be used to reference queries in math expressions.
900935
- `region` (String) The AWS region to query the metrics from.
901936

902-
<a id="nestedblock--queries--cloudwatch--dimension"></a>
903-
### Nested Schema for `queries.cloudwatch.dimension`
937+
<a id="nestedblock--queries--cloudwatch--metrics--dimension"></a>
938+
### Nested Schema for `queries.cloudwatch.metrics.dimension`
904939

905940
Required:
906941

@@ -909,6 +944,7 @@ Required:
909944

910945

911946

947+
912948
<a id="nestedblock--queries--prometheus"></a>
913949
### Nested Schema for `queries.prometheus`
914950

0 commit comments

Comments
 (0)