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

Sidecar support for tags and collectors with multiple configurations #13433

Merged
merged 100 commits into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
639e870
feature branch for multiple configs per collector and tags
mpfz0r Sep 8, 2022
450343e
Add "tags" field to DTOs (#13367)
thll Sep 8, 2022
d41c7e1
Merge remote-tracking branch 'origin/master' into sidecar-multi-confi…
mpfz0r Sep 13, 2022
4924df6
Merge remote-tracking branch 'origin/master' into sidecar-multi-confi…
thll Sep 14, 2022
57e75d0
Add spooldir variable to sidecars and their default collector configs…
mpfz0r Sep 14, 2022
0c3b03c
Merge branch 'master' into sidecar-multi-config-and-tags
mpfz0r Sep 15, 2022
58a7d49
Merge branch 'master' into sidecar-multi-config-and-tags
mpfz0r Sep 19, 2022
920fec3
Sidecar tagged assignments (#13409)
mpfz0r Sep 19, 2022
377b5d8
Merge branch 'master' into sidecar-multi-config-and-tags
mpfz0r Sep 20, 2022
1ce6a4f
Sidecar tags tests (#13502)
mpfz0r Sep 21, 2022
a1b2939
Fix cache invalidation for collector actions (#13504)
mpfz0r Sep 21, 2022
f725f86
Merge remote-tracking branch 'origin/master' into sidecar-multi-confi…
thll Sep 21, 2022
ac799b1
Invalidate registration cache only for affected sidecars (#13514)
thll Sep 22, 2022
9510911
Add description for tag variables
mpfz0r Sep 26, 2022
d65bbc5
Add "tags" field to DTOs (#13367)
thll Sep 8, 2022
80f175d
show CollectorProcessControl as an action button
gally47 Sep 13, 2022
3aa3879
added CollectorConfigurationModal
gally47 Sep 13, 2022
cc507a3
made search button in SearchForm optional
gally47 Sep 13, 2022
e10f257
Add spooldir variable to sidecars and their default collector configs…
mpfz0r Sep 14, 2022
353c113
handle edge case very long config names
gally47 Sep 15, 2022
35b06b3
handle edge cases when its not possible to configure
gally47 Sep 15, 2022
1cea932
change config list styling
gally47 Sep 18, 2022
0aa3e66
make CollectorConfigurationModal a reusable component
gally47 Sep 18, 2022
0c37116
added CollectorConfigurationModal in CollectorsAdministrationActions
gally47 Sep 18, 2022
b4b79c0
icon btn as edit btn progress
gally47 Sep 19, 2022
ecacf68
Sidecar tagged assignments (#13409)
mpfz0r Sep 19, 2022
686677a
renamed btn Assign Configurations
gally47 Sep 19, 2022
5ebcec9
fix wrong postion of ColorLabel
gally47 Sep 19, 2022
32b2104
disable eslint errors
gally47 Sep 19, 2022
9c3cef9
added ModalSubTitle styling
gally47 Sep 21, 2022
e906bca
Sidecar tags tests (#13502)
mpfz0r Sep 21, 2022
835a935
Fix cache invalidation for collector actions (#13504)
mpfz0r Sep 21, 2022
1e47494
Invalidate registration cache only for affected sidecars (#13514)
thll Sep 22, 2022
c8abf7b
added logic to CollectorConfigurationModal to support multiple sidecars
gally47 Sep 22, 2022
5e40ca2
onReset resets the search form too
gally47 Sep 23, 2022
40c5af3
updated confirmConfigurationChange fnct to support multiple sidecars
gally47 Sep 23, 2022
9b5d57b
simplify Configuration summary when multiple sidecars are selected
gally47 Sep 23, 2022
08101d1
finalized confirmation summary
gally47 Sep 26, 2022
9c31f04
fixed exit dialog by ESC key bug
gally47 Sep 26, 2022
266a862
Add description for tag variables
mpfz0r Sep 26, 2022
83d1f3a
added Configuration Tags field in Collector Configuration page
gally47 Sep 29, 2022
253ab04
prototype: implement auto assigned tags in config selection modal
gally47 Sep 29, 2022
1712597
finalized tags UI implementation
gally47 Sep 30, 2022
9e36962
fix linter issues
gally47 Sep 30, 2022
0020ad0
fix sidecars.node_name type error
gally47 Sep 30, 2022
ebf4b3b
handled case assigned_from_tags with multiple sidecarse
gally47 Sep 30, 2022
d3c62cb
hide close icon btn when isAssignedFromTags
gally47 Sep 30, 2022
4772f8d
fixed TemplatesHelper linter issues
gally47 Sep 30, 2022
b9bd8bb
cleanup
gally47 Sep 30, 2022
0c111a8
Merge branch 'master' into sidecars-ux-13362
gally47 Oct 4, 2022
4da5a63
Merge branch 'master' into sidecars-ux-13362
gally47 Oct 5, 2022
4ca057e
split CollectorConfigurationModal into 2 components to reduce complexity
gally47 Oct 5, 2022
f85a049
small css changes
gally47 Oct 7, 2022
ed6a40c
added tests for CollectorConfigurationModal
gally47 Oct 10, 2022
2b5777c
Merge branch 'master' into sidecars-ux-13362
gally47 Oct 10, 2022
6bd0724
fixed too long logic lines
gally47 Oct 10, 2022
ce5c410
avoid single charachter variables
gally47 Oct 10, 2022
0bc91b0
fixed Missing semicolons
gally47 Oct 10, 2022
1e60ad0
removed React. in hooks
gally47 Oct 10, 2022
acae1cc
Merge branch 'master' into sidecars-ux-13362
gally47 Oct 10, 2022
4d3a741
RegExp instance set into a variable
gally47 Oct 11, 2022
7d1afca
destruct props
gally47 Oct 11, 2022
4411fcb
used styled components
gally47 Oct 11, 2022
da7dd96
Merge branch 'master' into sidecars-ux-13362
gally47 Oct 12, 2022
ba7e6e1
css styled component changes
gally47 Oct 11, 2022
cdc0953
destruct CollectorsAdministrationActions props
gally47 Oct 11, 2022
4beb760
convert CollectorProcessControl to typescript and using React functio…
gally47 Oct 11, 2022
1b693c2
removed React. in hooks
gally47 Oct 11, 2022
7aa63fd
convert CollectorsAdministration to typescript and using React functi…
gally47 Oct 12, 2022
f35ece0
reset file
gally47 Oct 12, 2022
8ee80e4
convert CollectorsAdministrationActions to typescript and using React…
gally47 Oct 12, 2022
491e234
added types
gally47 Oct 12, 2022
4ccdd7e
fix eslint issues
gally47 Oct 13, 2022
e39f841
typed CollectorProcessControl props
gally47 Oct 13, 2022
b41c190
typed CollectorsAdministration props
gally47 Oct 13, 2022
b232205
typed CollectorsAdministrationActions props
gally47 Oct 13, 2022
384e0f8
typed function args and states
gally47 Oct 13, 2022
e97aaa1
converted ConfigurationTagsSelect to typescript and functional compo…
gally47 Oct 13, 2022
645bf64
converted TemplatesHelper to typescript and functional component
gally47 Oct 13, 2022
f1bef68
converted ConfigurationForm to typescript and functional component
gally47 Oct 13, 2022
f8fda80
Merge branch 'master' into sidecars-ux-13362
gally47 Oct 13, 2022
9b812d1
removed unused function
gally47 Oct 13, 2022
9596972
Merge branch 'master' into sidecars-ux-13362
gally47 Oct 14, 2022
02237f9
fixed config creation form
gally47 Oct 14, 2022
3e106c4
removed read only from types
gally47 Oct 14, 2022
63adfbc
used Proptypes.shape for configuration
gally47 Oct 14, 2022
7e4bf2e
fixed console error in SidecarNewConfigurationPage
gally47 Oct 14, 2022
14404f9
added type SidecarCollectorPairType
gally47 Oct 14, 2022
95561d3
make sure the filterQuery handles case error
gally47 Oct 17, 2022
d62c233
made tags field required
gally47 Oct 17, 2022
9ac33a3
ColorLabel using className instead of inline style
gally47 Oct 17, 2022
9cb462b
Merge remote-tracking branch 'origin/master' into sidecar-multi-confi…
mpfz0r Oct 18, 2022
0e8a8a0
converted inline-styling to styled-component in SearchForm
gally47 Oct 18, 2022
3198573
converted CollectorsAdministration.css into styled-components
gally47 Oct 18, 2022
5abd33b
addedstyled component for ColorLabel
gally47 Oct 18, 2022
7faad07
Merge branch 'master' into sidecar-multi-config-and-tags
mpfz0r Oct 19, 2022
b73fe4f
Merge remote-tracking branch 'origin/sidecar-multi-config-and-tags' i…
gally47 Oct 19, 2022
ffba6c7
Merge branch 'master' into sidecars-ux-13362
gally47 Oct 19, 2022
0b4daf3
added SidecarCollectorConfigurationFacade.java changes
gally47 Oct 19, 2022
8295662
Merge branch 'master' into sidecars-ux-13362
mpfz0r Oct 19, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class SidecarPluginConfiguration implements PluginConfigBean {
private Duration cacheTime = Duration.hours(1L);

@Parameter(value = PREFIX + "cache_max_size", validator = PositiveIntegerValidator.class)
private int cacheMaxSize = 100;
private int cacheMaxSize = 5000;

public Duration getCacheTime() {
return cacheTime;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ public void upgrade() {
"output.logstash:\n" +
" hosts: [\"192.168.1.1:5044\"]\n" +
"path:\n" +
" data: /var/lib/graylog-sidecar/collectors/filebeat/data\n" +
" logs: /var/lib/graylog-sidecar/collectors/filebeat/log"
" data: ${sidecar.spoolDir}/data\n" +
" logs: ${sidecar.spoolDir}/log"
);
ensureCollector(
"filebeat",
Expand All @@ -98,8 +98,8 @@ public void upgrade() {
"output.logstash:\n" +
" hosts: [\"192.168.1.1:5044\"]\n" +
"path:\n" +
" data: /var/lib/graylog-sidecar/collectors/filebeat/data\n" +
" logs: /var/lib/graylog-sidecar/collectors/filebeat/log"
" data: ${sidecar.spoolDir}/data\n" +
" logs: ${sidecar.spoolDir}/log"
);
ensureCollector(
"filebeat",
Expand All @@ -117,8 +117,8 @@ public void upgrade() {
"output.logstash:\n" +
" hosts: [\"192.168.1.1:5044\"]\n" +
"path:\n" +
" data: /var/lib/graylog-sidecar/collectors/filebeat/data\n" +
" logs: /var/lib/graylog-sidecar/collectors/filebeat/log"
" data: ${sidecar.spoolDir}/data\n" +
" logs: ${sidecar.spoolDir}/log"
);
ensureCollector(
"winlogbeat",
Expand All @@ -131,8 +131,8 @@ public void upgrade() {
"output.logstash:\n" +
" hosts: [\"192.168.1.1:5044\"]\n" +
"path:\n" +
" data: C:\\Program Files\\Graylog\\sidecar\\cache\\winlogbeat\\data\n" +
" logs: C:\\Program Files\\Graylog\\sidecar\\logs\n" +
" data: ${sidecar.spoolDir}\\data\n" +
" logs: ${sidecar.spoolDir}\\logs\n" +
"tags:\n" +
" - windows\n" +
"winlogbeat:\n" +
Expand Down Expand Up @@ -164,9 +164,9 @@ public void upgrade() {
"Group nxlog\n" +
"\n" +
"Moduledir /usr/lib/nxlog/modules\n" +
"CacheDir /var/spool/nxlog/data\n" +
"PidFile /var/run/nxlog/nxlog.pid\n" +
"LogFile /var/log/nxlog/nxlog.log\n" +
"CacheDir ${sidecar.spoolDir}/data\n" +
"PidFile ${sidecar.spoolDir}/nxlog.pid\n" +
"LogFile ${sidecar.spoolDir}/nxlog.log\n" +
"LogLevel INFO\n" +
"\n" +
"\n" +
Expand Down Expand Up @@ -217,7 +217,7 @@ public void upgrade() {
"C:\\Program Files (x86)\\nxlog\\nxlog.exe",
"-c \"%s\"",
"-v -f -c \"%s\"",
"define ROOT C:\\Program Files (x86)\\nxlog\n" +
"define ROOT ${sidecar.spoolDir}\\nxlog\n" +
"\n" +
"Moduledir %ROOT%\\modules\n" +
"CacheDir %ROOT%\\data\n" +
Expand Down Expand Up @@ -302,8 +302,8 @@ public void upgrade() {
"output.logstash:\n" +
" hosts: [\"192.168.1.1:5044\"]\n" +
"path:\n" +
" data: C:\\Program Files\\Graylog\\sidecar\\cache\\filebeat\\data\n" +
" logs: C:\\Program Files\\Graylog\\sidecar\\logs\n" +
" data: ${sidecar.spoolDir}\\data\n" +
" logs: ${sidecar.spoolDir}\\logs\n" +
"tags:\n" +
" - windows\n" +
"filebeat.inputs:\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.auto.value.AutoValue;

import javax.annotation.Nullable;

@AutoValue
@JsonAutoDetect
public abstract class CollectorStatus {
Expand All @@ -36,11 +38,16 @@ public abstract class CollectorStatus {
@JsonProperty("verbose_message")
public abstract String verboseMessage();

@JsonProperty("configuration_id")
@Nullable
public abstract String configurationId();

@JsonCreator
public static CollectorStatus create(@JsonProperty("collector_id") String collectorId,
@JsonProperty("status") int status,
@JsonProperty("message") String message,
@JsonProperty("verbose_message") String verboseMessage) {
return new AutoValue_CollectorStatus(collectorId, status, message, verboseMessage);
@JsonProperty("verbose_message") String verboseMessage,
@JsonProperty("configuration_id") @Nullable String configurationId) {
return new AutoValue_CollectorStatus(collectorId, status, message, verboseMessage, configurationId);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.mongojack.ObjectId;

import javax.annotation.Nullable;
import java.util.Set;

@AutoValue
@WithBeanGetter
Expand All @@ -35,6 +36,7 @@ public abstract class Configuration {
public static final String FIELD_NAME = "name";
public static final String FIELD_COLOR = "color";
public static final String FIELD_TEMPLATE = "template";
public static final String FIELD_TAGS = "tags";

@Id
@ObjectId
Expand All @@ -54,30 +56,37 @@ public abstract class Configuration {
@JsonProperty(FIELD_TEMPLATE)
public abstract String template();

@JsonProperty(FIELD_TAGS)
public abstract Set<String> tags();

@JsonCreator
public static Configuration create(@JsonProperty(FIELD_ID) String id,
@JsonProperty(FIELD_COLLECTOR_ID) String collectorId,
@JsonProperty(FIELD_NAME) String name,
@JsonProperty(FIELD_COLOR) String color,
@JsonProperty(FIELD_TEMPLATE) String template) {
@JsonProperty(FIELD_TEMPLATE) String template,
@JsonProperty(FIELD_TAGS) @Nullable Set<String> tags) {
return builder()
.id(id)
.collectorId(collectorId)
.name(name)
.color(color)
.template(template)
.tags(tags == null ? Set.of() : tags)
.build();
}

public static Configuration create(String collectorId,
String name,
String color,
String template) {
public static Configuration createWithoutId(String collectorId,
String name,
String color,
String template,
Set<String> tags) {
return create(new org.bson.types.ObjectId().toHexString(),
collectorId,
name,
color,
template);
template,
tags);
}

public static Builder builder() {
Expand All @@ -98,6 +107,8 @@ public abstract static class Builder {

public abstract Builder template(String template);

public abstract Builder tags(Set<String> tags);

public abstract Configuration build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import org.mongojack.Id;
import org.mongojack.ObjectId;

import java.util.Set;

@AutoValue
public abstract class ConfigurationSummary {
@JsonProperty("id")
Expand All @@ -38,20 +40,25 @@ public abstract class ConfigurationSummary {
@JsonProperty("color")
public abstract String color();

@JsonProperty("tags")
public abstract Set<String> tags();

@JsonCreator
public static ConfigurationSummary create(@JsonProperty("id") @Id @ObjectId String id,
@JsonProperty("name") String name,
@JsonProperty("collector_id") String collectorId,
@JsonProperty("color") String color) {
return new AutoValue_ConfigurationSummary(id, name, collectorId, color);
@JsonProperty("color") String color,
@JsonProperty("tags") Set<String> tags) {
return new AutoValue_ConfigurationSummary(id, name, collectorId, color, tags);
}

public static ConfigurationSummary create(Configuration configuration) {
return create(
configuration.id(),
configuration.name(),
configuration.collectorId(),
configuration.color());
configuration.color(),
configuration.tags());
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,19 @@

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.auto.value.AutoValue;

import javax.annotation.Nullable;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List;
import java.util.Set;

@AutoValue
@JsonAutoDetect
@JsonIgnoreProperties(ignoreUnknown = true)
public abstract class NodeDetails {
@JsonProperty("operating_system")
@NotNull
Expand All @@ -50,12 +53,21 @@ public abstract class NodeDetails {
@Nullable
public abstract CollectorStatusList statusList();

@JsonProperty("tags")
public abstract Set<String> tags();

@JsonProperty("collector_configuration_directory")
@Nullable
public abstract String collectorConfigurationDirectory();

@JsonCreator
public static NodeDetails create(@JsonProperty("operating_system") String operatingSystem,
@JsonProperty("ip") @Nullable String ip,
@JsonProperty("metrics") @Nullable NodeMetrics metrics,
@JsonProperty("log_file_list") @Nullable List<NodeLogFile> logFileList,
@JsonProperty("status") @Nullable CollectorStatusList statusList) {
return new AutoValue_NodeDetails(operatingSystem, ip, metrics, logFileList, statusList);
@JsonProperty("status") @Nullable CollectorStatusList statusList,
@JsonProperty("tags") @Nullable Set<String> tags,
@JsonProperty("collector_configuration_directory") @Nullable String configDir) {
return new AutoValue_NodeDetails(operatingSystem, ip, metrics, logFileList, statusList, tags == null ? Set.of() : tags, configDir);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ public static Status fromString(String statusString) {
public abstract NodeDetails nodeDetails();

@JsonProperty
@Nullable
public abstract List<ConfigurationAssignment> assignments();

@JsonProperty
Expand Down Expand Up @@ -133,7 +132,7 @@ public static Sidecar create(@JsonProperty(FIELD_ID) @Id @ObjectId String id,
.nodeId(nodeId)
.nodeName(nodeName)
.nodeDetails(nodeDetails)
.assignments(assignments)
.assignments(assignments == null ? List.of() : assignments)
.sidecarVersion(sidecarVersion)
.lastSeen(lastSeen)
.build();
Expand All @@ -151,6 +150,7 @@ public static Sidecar create(@JsonProperty(FIELD_NODE_ID) String nodeId,
.nodeDetails(nodeDetails)
.sidecarVersion(sidecarVersion)
.lastSeen(DateTime.now(DateTimeZone.UTC))
.assignments(List.of())
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public abstract class BulkActionRequest {
public abstract List<String> collectorIds();

@JsonCreator
public static BulkActionRequest create(@JsonProperty("sidecar_id") String collectorId,
public static BulkActionRequest create(@JsonProperty("sidecar_id") String sidecarId,
@JsonProperty("collector_ids") List<String> collectorIds) {
return new AutoValue_BulkActionRequest(collectorId, collectorIds);
return new AutoValue_BulkActionRequest(sidecarId, collectorIds);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.auto.value.AutoValue;

import javax.annotation.Nullable;
import java.util.Set;

@AutoValue
@JsonAutoDetect
public abstract class ConfigurationAssignment {
Expand All @@ -30,9 +33,13 @@ public abstract class ConfigurationAssignment {
@JsonProperty
public abstract String configurationId();

@JsonProperty
public abstract Set<String> assignedFromTags();

@JsonCreator
public static ConfigurationAssignment create(@JsonProperty("collector_id") String collectorId,
@JsonProperty("configuration_id") String configurationId) {
return new AutoValue_ConfigurationAssignment(collectorId, configurationId);
@JsonProperty("configuration_id") String configurationId,
@JsonProperty("assigned_from_tags") @Nullable Set<String> assignedFromTags) {
return new AutoValue_ConfigurationAssignment(collectorId, configurationId, assignedFromTags == null ? Set.of() : assignedFromTags);
}
}
Loading