Skip to content

Commit 113a3db

Browse files
authored
Merge pull request #686 from SumoLogic/yuting-SUMO-247498-fix-hashAlrogithm
SUMO-247498 Add hashAlgorithm to common source properties
2 parents ec0fcb0 + c27e783 commit 113a3db

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

sumologic/sumologic_sources.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ type Source struct {
2525
ForceTimeZone bool `json:"forceTimeZone"`
2626
DefaultDateFormats []DefaultDateFormat `json:"defaultDateFormats,omitempty"`
2727
Filters []Filter `json:"filters,omitempty"`
28+
HashAlgorithm string `json:"hashAlgorithm,omitempty"`
2829
CutoffTimestamp int `json:"cutoffTimestamp,omitempty"`
2930
CutoffRelativeTime string `json:"cutoffRelativeTime,omitempty"`
3031
Fields map[string]interface{} `json:"fields,omitempty"`
@@ -142,6 +143,12 @@ func resourceSumologicSource() *schema.Resource {
142143
},
143144
},
144145
},
146+
"hash_algorithm": {
147+
Type: schema.TypeString,
148+
Optional: true,
149+
Default: nil,
150+
ValidateFunc: validation.StringInSlice([]string{"MD5", "SHA-256"}, false),
151+
},
145152
"cutoff_timestamp": {
146153
Type: schema.TypeInt,
147154
Optional: true,
@@ -234,6 +241,7 @@ func resourceToSource(d *schema.ResourceData) Source {
234241
source.ForceTimeZone = d.Get("force_timezone").(bool)
235242
source.DefaultDateFormats = getDefaultDateFormats(d)
236243
source.Filters = getFilters(d)
244+
source.HashAlgorithm = d.Get("hash_algorithm").(string)
237245
source.CutoffTimestamp = d.Get("cutoff_timestamp").(int)
238246
source.CutoffRelativeTime = d.Get("cutoff_relative_time").(string)
239247
source.Fields = d.Get("fields").(map[string]interface{})
@@ -259,6 +267,7 @@ func resourceSumologicSourceRead(d *schema.ResourceData, source Source) error {
259267
if err := d.Set("filters", flattenFilters(source.Filters)); err != nil {
260268
return fmt.Errorf("error setting filters for resource %s: %s", d.Id(), err)
261269
}
270+
d.Set("hash_algorithm", source.HashAlgorithm)
262271
d.Set("cutoff_timestamp", source.CutoffTimestamp)
263272
d.Set("cutoff_relative_time", source.CutoffRelativeTime)
264273
if err := d.Set("fields", source.Fields); err != nil {

website/docs/index.html.markdown

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ The following properties are common to ALL sources and can be used to configure
126126
- `force_timezone` - (Optional) Type true to force the source to use a specific time zone, otherwise type false to use the time zone found in the logs. The default setting is false.
127127
- `default_date_formats` - (Optional) Define the format for the timestamps present in your log messages. You can specify a locator regex to identify where timestamps appear in log lines. Requires 'automatic_date_parsing' set to True.
128128
+ `format` - (Required) The timestamp format supplied as a Java SimpleDateFormat, or "epoch" if the timestamp is in epoch format.
129-
+ `locator` - (Optional) Regular expression to locate the timestamp within the messages.
129+
+ `locator` - (Optional) Regular expression to locate the timestamp within the messages.
130130

131131
Usage:
132132
```hcl
@@ -155,6 +155,7 @@ The following properties are common to ALL sources and can be used to configure
155155
mask = "MaskedID"
156156
}
157157
```
158+
- `hash_algorithm` - (Optional) Define the hash algorithm used for Hash type filters. Available values are "MD5" and "SHA-256". The default value will be "MD5".
158159
- `cutoff_timestamp` - (Optional) Only collect data more recent than this timestamp, specified as milliseconds since epoch (13 digit). This maps to the `Collection should begin` field on the UI. Example: using `1663786159000` will set the cutoff timestamp to `Wednesday, September 21, 2022 6:49:19 PM GMT`
159160
- `cutoff_relative_time` - (Optional) Can be specified instead of cutoffTimestamp to provide a relative offset with respect to the current time.This maps to the `Collection should begin` field on the UI. Example: use -1h, -1d, or -1w to collect data that's less than one hour, one day, or one week old, respectively.
160161
- `fields` - (Optional) Map containing key/value pairs.

0 commit comments

Comments
 (0)