Compare commits
No commits in common. "efbd25c2a627ba311ef502035e4a0f36d2ceba22" and "97ac9b0c4b4364e3f11bbbd5e708b5dd40986936" have entirely different histories.
efbd25c2a6
...
97ac9b0c4b
10
.mvn/jvm.config
Normal file
10
.mvn/jvm.config
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
|
||||||
|
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
|
||||||
|
--add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED
|
||||||
|
--add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED
|
||||||
|
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
|
||||||
|
--add-exports jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED
|
||||||
|
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
|
||||||
|
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
|
||||||
|
--add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
|
||||||
|
--add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED
|
File diff suppressed because it is too large
Load Diff
177
pom.xml
177
pom.xml
@ -25,7 +25,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.graylog.plugins</groupId>
|
<groupId>org.graylog.plugins</groupId>
|
||||||
<artifactId>graylog-plugin-web-parent</artifactId>
|
<artifactId>graylog-plugin-web-parent</artifactId>
|
||||||
<version>6.0.0</version>
|
<version>5.0.0</version>
|
||||||
<relativePath>../graylog2-server/graylog-plugin-parent/graylog-plugin-web-parent</relativePath>
|
<relativePath>../graylog2-server/graylog-plugin-parent/graylog-plugin-web-parent</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
@ -54,69 +54,56 @@
|
|||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<maven.compiler.release>11</maven.compiler.release>
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
<maven.compiler.source>11</maven.compiler.source>
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
<maven.compiler.target>11</maven.compiler.target>
|
|
||||||
<maven.compiler.useIncrementalCompilation>false</maven.compiler.useIncrementalCompilation>
|
|
||||||
|
|
||||||
<!-- Plugins will not be deployed by default - set to `false` if you actually want to deploy it -->
|
<!-- Plugins will not be deployed by default - set to `false` if you actually want to deploy it -->
|
||||||
<maven.deploy.skip>true</maven.deploy.skip>
|
<maven.deploy.skip>true</maven.deploy.skip>
|
||||||
|
|
||||||
|
<graylog.version>${project.parent.version}</graylog.version>
|
||||||
<graylog.plugin-dir>/usr/share/graylog-server/plugin</graylog.plugin-dir>
|
<graylog.plugin-dir>/usr/share/graylog-server/plugin</graylog.plugin-dir>
|
||||||
|
|
||||||
<graylog.version>6.0.0</graylog.version>
|
|
||||||
<guice.version>7.0.0</guice.version>
|
|
||||||
<auto-value.version>1.10.4</auto-value.version>
|
|
||||||
<auto-value-javabean.version>2.5.2</auto-value-javabean.version>
|
|
||||||
<jackson.version>2.17.1</jackson.version>
|
|
||||||
<validation-api.version>3.0.2</validation-api.version>
|
|
||||||
<joda-time.version>2.12.7</joda-time.version>
|
|
||||||
<commons-lang3.version>3.14.0</commons-lang3.version>
|
|
||||||
<metrics.version>4.2.25</metrics.version>
|
|
||||||
<javax.annotation-api.version>1.3.2</javax.annotation-api.version>
|
|
||||||
<license-maven.version>4.3</license-maven.version>
|
|
||||||
|
|
||||||
<!-- Nodejs dependencies -->
|
|
||||||
<nodejs.version>v18.18.0</nodejs.version>
|
|
||||||
<yarn.version>v1.22.19</yarn.version>
|
|
||||||
|
|
||||||
<!-- Plugin versions -->
|
|
||||||
<license-maven.version>4.3</license-maven.version>
|
|
||||||
<download-maven-plugin.version>1.6.8.1</download-maven-plugin.version>
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
<!-- <distributionManagement>
|
||||||
|
<snapshotRepository>
|
||||||
|
<id>sonatype-nexus-snapshots</id>
|
||||||
|
<name>Sonatype Nexus Snapshots</name>
|
||||||
|
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||||
|
</snapshotRepository>
|
||||||
|
<repository>
|
||||||
|
<id>sonatype-nexus-staging</id>
|
||||||
|
<name>Nexus Release Repository</name>
|
||||||
|
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
||||||
|
</repository>
|
||||||
|
</distributionManagement>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
--> <!-- to make our snapshot releases work with Travis et al -->
|
||||||
|
<!-- <repository>
|
||||||
|
<id>sonatype-nexus-snapshots</id>
|
||||||
|
<name>Sonatype Nexus Snapshots</name>
|
||||||
|
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||||
|
<releases>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</releases>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>sonatype-nexus-releases</id>
|
||||||
|
<name>Sonatype Nexus Releases</name>
|
||||||
|
<url>https://oss.sonatype.org/content/repositories/releases</url>
|
||||||
|
<releases>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</releases>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
-->
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- com.codahale.metrics -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.dropwizard.metrics</groupId>
|
|
||||||
<artifactId>metrics-core</artifactId>
|
|
||||||
<version>${metrics.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
|
||||||
<artifactId>jackson-databind</artifactId>
|
|
||||||
<version>${jackson.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>jakarta.validation</groupId>
|
|
||||||
<artifactId>jakarta.validation-api</artifactId>
|
|
||||||
<version>${validation-api.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>joda-time</groupId>
|
|
||||||
<artifactId>joda-time</artifactId>
|
|
||||||
<version>${joda-time.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.commons</groupId>
|
|
||||||
<artifactId>commons-lang3</artifactId>
|
|
||||||
<version>${commons-lang3.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.google.auto.value</groupId>
|
|
||||||
<artifactId>auto-value-annotations</artifactId>
|
|
||||||
<version>${auto-value.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.graylog2</groupId>
|
<groupId>org.graylog2</groupId>
|
||||||
<artifactId>graylog2-server</artifactId>
|
<artifactId>graylog2-server</artifactId>
|
||||||
@ -131,24 +118,6 @@
|
|||||||
<type>test-jar</type>
|
<type>test-jar</type>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.slf4j</groupId>
|
|
||||||
<artifactId>slf4j-jdk14</artifactId>
|
|
||||||
<version>1.7.21</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.google.inject</groupId>
|
|
||||||
<artifactId>guice</artifactId>
|
|
||||||
<version>${guice.version}</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.google.inject.extensions</groupId>
|
|
||||||
<artifactId>guice-assistedinject</artifactId>
|
|
||||||
<version>${guice.version}</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.auto.value</groupId>
|
<groupId>com.google.auto.value</groupId>
|
||||||
<artifactId>auto-value</artifactId>
|
<artifactId>auto-value</artifactId>
|
||||||
@ -178,12 +147,42 @@
|
|||||||
</resources>
|
</resources>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>de.thetaphi</groupId>
|
<groupId>com.mycila</groupId>
|
||||||
<artifactId>forbiddenapis</artifactId>
|
<artifactId>license-maven-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<skip>true</skip>
|
<licenseSets>
|
||||||
|
<licenseSet>
|
||||||
|
<header>com/mycila/maven/plugin/license/templates/SSPL-1.txt</header>
|
||||||
|
<properties>
|
||||||
|
<project.inceptionYear>2024</project.inceptionYear>
|
||||||
|
<owner>johan@nosd.in</owner>
|
||||||
|
</properties>
|
||||||
|
<includes>
|
||||||
|
<include>**/src/main/java/**</include>
|
||||||
|
<include>**/src/test/java/**</include>
|
||||||
|
<include>**/pom.xml</include>
|
||||||
|
<include>*.js</include>
|
||||||
|
<include>src/web/**/*.js</include>
|
||||||
|
<include>src/web/**/*.jsx</include>
|
||||||
|
<include>src/web/**/*.ts</include>
|
||||||
|
<include>src/web/**/*.tsx</include>
|
||||||
|
<include>src/web/**/*.css</include>
|
||||||
|
</includes>
|
||||||
|
<excludes>
|
||||||
|
<exclude>*.config.js</exclude>
|
||||||
|
</excludes>
|
||||||
|
</licenseSet>
|
||||||
|
</licenseSets>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>check</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-assembly-plugin</artifactId>
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
@ -194,25 +193,12 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.13.0</version>
|
<version>3.10.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<release>17</release>
|
<release>17</release>
|
||||||
<showWarnings>true</showWarnings>
|
<showWarnings>true</showWarnings>
|
||||||
<showDeprecation>true</showDeprecation>
|
<showDeprecation>true</showDeprecation>
|
||||||
<forceJavacCompilerUse>false</forceJavacCompilerUse>
|
<forceJavacCompilerUse>true</forceJavacCompilerUse>
|
||||||
<fork>true</fork>
|
|
||||||
<compilerArgs>
|
|
||||||
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
|
|
||||||
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg>
|
|
||||||
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
|
|
||||||
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg>
|
|
||||||
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</arg>
|
|
||||||
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg>
|
|
||||||
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED</arg>
|
|
||||||
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg>
|
|
||||||
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
|
|
||||||
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED</arg>
|
|
||||||
</compilerArgs>
|
|
||||||
<annotationProcessors>
|
<annotationProcessors>
|
||||||
<annotationProcessor>com.google.auto.value.processor.AutoValueProcessor</annotationProcessor>
|
<annotationProcessor>com.google.auto.value.processor.AutoValueProcessor</annotationProcessor>
|
||||||
</annotationProcessors>
|
</annotationProcessors>
|
||||||
@ -238,12 +224,6 @@
|
|||||||
<version>2.4.1</version>
|
<version>2.4.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<minimizeJar>false</minimizeJar>
|
<minimizeJar>false</minimizeJar>
|
||||||
<artifactSet>
|
|
||||||
<excludes>
|
|
||||||
<exclude>com.fasterxml.jackson.core:*</exclude>
|
|
||||||
<exclude>joda-time:joda-time</exclude>
|
|
||||||
</excludes>
|
|
||||||
</artifactSet>
|
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
@ -342,7 +322,6 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>com.github.eirslett</groupId>
|
<groupId>com.github.eirslett</groupId>
|
||||||
<artifactId>frontend-maven-plugin</artifactId>
|
<artifactId>frontend-maven-plugin</artifactId>
|
||||||
<version>1.15.0</version>
|
|
||||||
|
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
|
@ -30,11 +30,11 @@ import java.util.Collections;
|
|||||||
public class RedisLookupPlugin implements Plugin {
|
public class RedisLookupPlugin implements Plugin {
|
||||||
@Override
|
@Override
|
||||||
public PluginMetaData metadata() {
|
public PluginMetaData metadata() {
|
||||||
return new RedisLookupMetaData();
|
return new RedisLookupPluginMetaData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<PluginModule> modules () {
|
public Collection<PluginModule> modules () {
|
||||||
return Collections.<PluginModule>singletonList(new RedisLookupModule());
|
return Collections.<PluginModule>singletonList(new RedisLookupPluginModule());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,17 +27,17 @@ import java.util.Set;
|
|||||||
/**
|
/**
|
||||||
* Implement the PluginMetaData interface here.
|
* Implement the PluginMetaData interface here.
|
||||||
*/
|
*/
|
||||||
public class RedisLookupMetaData implements PluginMetaData {
|
public class RedisLookupPluginMetaData implements PluginMetaData {
|
||||||
private static final String PLUGIN_PROPERTIES = "in.nosd.redis.graylog-plugin-redis-lookup/graylog-plugin.properties";
|
private static final String PLUGIN_PROPERTIES = "in.nosd.redis.graylog-plugin-redis-lookup/graylog-plugin.properties";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUniqueId() {
|
public String getUniqueId() {
|
||||||
return "in.nosd.redis.RedisLookupPlugin";
|
return "in.nosd.redis.RedisLookupPluginPlugin";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "Redis Lookup";
|
return "RedisLookupPlugin";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
@ -16,15 +16,14 @@
|
|||||||
*/
|
*/
|
||||||
package in.nosd.redis;
|
package in.nosd.redis;
|
||||||
|
|
||||||
|
import com.google.inject.Binder;
|
||||||
|
import com.google.inject.TypeLiteral;
|
||||||
|
import com.google.inject.multibindings.MapBinder;
|
||||||
|
|
||||||
import org.graylog.plugins.pipelineprocessor.ast.functions.Function;
|
import org.graylog.plugins.pipelineprocessor.ast.functions.Function;
|
||||||
import org.graylog2.plugin.PluginConfigBean;
|
import org.graylog2.plugin.PluginConfigBean;
|
||||||
import org.graylog2.plugin.PluginModule;
|
import org.graylog2.plugin.PluginModule;
|
||||||
|
|
||||||
import com.google.inject.multibindings.MapBinder;
|
|
||||||
import com.google.inject.Binder;
|
|
||||||
import com.google.inject.TypeLiteral;
|
|
||||||
|
|
||||||
import in.nosd.redis.dataadapters.RedisLookupDataAdapter;
|
import in.nosd.redis.dataadapters.RedisLookupDataAdapter;
|
||||||
import in.nosd.redis.functions.RedisLookupPluginFunction;
|
import in.nosd.redis.functions.RedisLookupPluginFunction;
|
||||||
|
|
||||||
@ -34,7 +33,7 @@ import java.util.Set;
|
|||||||
/**
|
/**
|
||||||
* Extend the PluginModule abstract class here to add you plugin to the system.
|
* Extend the PluginModule abstract class here to add you plugin to the system.
|
||||||
*/
|
*/
|
||||||
public class RedisLookupModule extends PluginModule {
|
public class RedisLookupPluginModule extends PluginModule {
|
||||||
/**
|
/**
|
||||||
* Returns all configuration beans required by this plugin.
|
* Returns all configuration beans required by this plugin.
|
||||||
*
|
*
|
||||||
@ -56,7 +55,7 @@ public class RedisLookupModule extends PluginModule {
|
|||||||
* addMessageFilter(Class<? extends MessageFilter>);
|
* addMessageFilter(Class<? extends MessageFilter>);
|
||||||
* addMessageOutput(Class<? extends MessageOutput>);
|
* addMessageOutput(Class<? extends MessageOutput>);
|
||||||
* addPeriodical(Class<? extends Periodical>);
|
* addPeriodical(Class<? extends Periodical>);
|
||||||
// * addAlarmCallback(Class<? extends AlarmCallback>);
|
* addAlarmCallback(Class<? extends AlarmCallback>);
|
||||||
* addInitializer(Class<? extends Service>);
|
* addInitializer(Class<? extends Service>);
|
||||||
* addRestResource(Class<? extends PluginRestResource>);
|
* addRestResource(Class<? extends PluginRestResource>);
|
||||||
*
|
*
|
39
src/main/java/in/nosd/redis/RedisLookupPluginPlugin.java
Normal file
39
src/main/java/in/nosd/redis/RedisLookupPluginPlugin.java
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2024 johan@nosd.in
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the Server Side Public License, version 1,
|
||||||
|
* as published by MongoDB, Inc.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* Server Side Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the Server Side Public License
|
||||||
|
* along with this program. If not, see
|
||||||
|
* <http://www.mongodb.com/licensing/server-side-public-license>.
|
||||||
|
*/
|
||||||
|
package in.nosd.redis;
|
||||||
|
|
||||||
|
import org.graylog2.plugin.Plugin;
|
||||||
|
import org.graylog2.plugin.PluginMetaData;
|
||||||
|
import org.graylog2.plugin.PluginModule;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implement the Plugin interface here.
|
||||||
|
*/
|
||||||
|
public class RedisLookupPluginPlugin implements Plugin {
|
||||||
|
@Override
|
||||||
|
public PluginMetaData metadata() {
|
||||||
|
return new RedisLookupPluginMetaData();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<PluginModule> modules () {
|
||||||
|
return Collections.<PluginModule>singletonList(new RedisLookupPluginModule());
|
||||||
|
}
|
||||||
|
}
|
@ -16,20 +16,6 @@
|
|||||||
*/
|
*/
|
||||||
package in.nosd.redis.dataadapters;
|
package in.nosd.redis.dataadapters;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.graylog.autovalue.WithBeanGetter;
|
|
||||||
import org.graylog2.lookup.dto.DataAdapterDto;
|
|
||||||
import org.graylog2.plugin.lookup.LookupCachePurge;
|
|
||||||
import org.graylog2.plugin.lookup.LookupDataAdapter;
|
|
||||||
import org.graylog2.plugin.lookup.LookupDataAdapterConfiguration;
|
|
||||||
import org.graylog2.plugin.lookup.LookupResult;
|
|
||||||
import org.joda.time.Duration;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import com.codahale.metrics.Meter;
|
import com.codahale.metrics.Meter;
|
||||||
import com.codahale.metrics.MetricRegistry;
|
import com.codahale.metrics.MetricRegistry;
|
||||||
import com.codahale.metrics.Timer;
|
import com.codahale.metrics.Timer;
|
||||||
@ -40,18 +26,37 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||||
import com.google.auto.value.AutoValue;
|
import com.google.auto.value.AutoValue;
|
||||||
|
import org.graylog2.lookup.dto.DataAdapterDto;
|
||||||
import com.google.common.collect.ArrayListMultimap;
|
import com.google.common.collect.ArrayListMultimap;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import com.google.inject.Inject;
|
|
||||||
import com.google.inject.assistedinject.Assisted;
|
import com.google.inject.assistedinject.Assisted;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import io.lettuce.core.RedisClient;
|
import io.lettuce.core.RedisClient;
|
||||||
import io.lettuce.core.RedisURI;
|
import io.lettuce.core.RedisURI;
|
||||||
import io.lettuce.core.api.StatefulRedisConnection;
|
import io.lettuce.core.api.StatefulRedisConnection;
|
||||||
import io.lettuce.core.api.sync.RedisCommands;
|
import io.lettuce.core.api.sync.RedisCommands;
|
||||||
import jakarta.validation.constraints.Min;
|
import in.nosd.redis.dataadapters.AutoValue_RedisLookupDataAdapter_Config;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import org.graylog2.plugin.lookup.LookupCachePurge;
|
||||||
import reactor.util.annotation.Nullable;
|
import org.graylog2.plugin.lookup.LookupDataAdapter;
|
||||||
|
import org.graylog2.plugin.lookup.LookupDataAdapterConfiguration;
|
||||||
|
import org.graylog2.plugin.lookup.LookupResult;
|
||||||
|
import org.joda.time.Duration;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import com.google.inject.Inject;
|
||||||
|
import com.google.inject.assistedinject.Assisted;
|
||||||
|
import javax.validation.constraints.Min;
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.StringJoiner;
|
||||||
|
|
||||||
public class RedisLookupDataAdapter extends LookupDataAdapter {
|
public class RedisLookupDataAdapter extends LookupDataAdapter {
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(RedisLookupDataAdapter.class);
|
private static final Logger LOG = LoggerFactory.getLogger(RedisLookupDataAdapter.class);
|
||||||
@ -85,8 +90,8 @@ public class RedisLookupDataAdapter extends LookupDataAdapter {
|
|||||||
public RedisLookupDataAdapter(@Assisted("dto") DataAdapterDto dto,
|
public RedisLookupDataAdapter(@Assisted("dto") DataAdapterDto dto,
|
||||||
MetricRegistry metricRegistry) {
|
MetricRegistry metricRegistry) {
|
||||||
super(dto, metricRegistry);
|
super(dto, metricRegistry);
|
||||||
this.config = (Config) dto.config();
|
|
||||||
|
|
||||||
|
this.config = (Config) dto.config();
|
||||||
RedisURI redisUri ;
|
RedisURI redisUri ;
|
||||||
redisUri = RedisURI.Builder.redis(this.config.redisHost(),this.config.redisPort())
|
redisUri = RedisURI.Builder.redis(this.config.redisHost(),this.config.redisPort())
|
||||||
.withPort(this.config.redisPort())
|
.withPort(this.config.redisPort())
|
||||||
@ -182,6 +187,7 @@ public class RedisLookupDataAdapter extends LookupDataAdapter {
|
|||||||
// This is deprecated, see setValue
|
// This is deprecated, see setValue
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void set(Object key, Object value) {
|
public void set(Object key, Object value) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -189,7 +195,6 @@ public class RedisLookupDataAdapter extends LookupDataAdapter {
|
|||||||
return setValueWithTtl(key, value, this.config.redisKeyTTL());
|
return setValueWithTtl(key, value, this.config.redisKeyTTL());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public LookupResult setValueWithTtl(Object key, Object value, Long ttlSec) {
|
public LookupResult setValueWithTtl(Object key, Object value, Long ttlSec) {
|
||||||
final Timer.Context time = redisSetRequestTimer.time();
|
final Timer.Context time = redisSetRequestTimer.time();
|
||||||
final String trimmedKey = StringUtils.trimToNull(key.toString());
|
final String trimmedKey = StringUtils.trimToNull(key.toString());
|
||||||
@ -268,7 +273,6 @@ public class RedisLookupDataAdapter extends LookupDataAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TTL -1 = never expire
|
// TTL -1 = never expire
|
||||||
@Override
|
|
||||||
public LookupResult assignTtl(Object key, Long ttlSec) {
|
public LookupResult assignTtl(Object key, Long ttlSec) {
|
||||||
final Timer.Context time = redisAssignTtlRequestTimer.time();
|
final Timer.Context time = redisAssignTtlRequestTimer.time();
|
||||||
final String trimmedKey = StringUtils.trimToNull(key.toString());
|
final String trimmedKey = StringUtils.trimToNull(key.toString());
|
||||||
@ -343,12 +347,11 @@ public class RedisLookupDataAdapter extends LookupDataAdapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public LookupResult setStringListWithTtl(Object key, List<String> listValue, Long ttlSec) {
|
public LookupResult setStringListWithTtl(Object key, List<String> listValue, Long ttlSec) {
|
||||||
final Timer.Context time = redisSetStringListWithTtlRequestTimer.time();
|
final Timer.Context time = redisSetStringListWithTtlRequestTimer.time();
|
||||||
try {
|
try {
|
||||||
setStringList(key, listValue);
|
setStringList(key, listValue);
|
||||||
return assignTtl(key, ttlSec);
|
return(assignTtl(key, ttlSec));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// This exception comes from assignTtl
|
// This exception comes from assignTtl
|
||||||
if (e.getMessage().startsWith("WRONGTYPE Operation against a key holding the wrong kind of value")) {
|
if (e.getMessage().startsWith("WRONGTYPE Operation against a key holding the wrong kind of value")) {
|
||||||
@ -417,12 +420,11 @@ public class RedisLookupDataAdapter extends LookupDataAdapter {
|
|||||||
|
|
||||||
|
|
||||||
@AutoValue
|
@AutoValue
|
||||||
@WithBeanGetter
|
|
||||||
@JsonAutoDetect
|
@JsonAutoDetect
|
||||||
@JsonDeserialize(builder = AutoValue_RedisLookupDataAdapter_Config.Builder.class)
|
@JsonDeserialize(builder = RedisLookupDataAdapter.Config.Builder.class)
|
||||||
@JsonTypeName(NAME)
|
@JsonTypeName(NAME)
|
||||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||||
public static abstract class Config implements LookupDataAdapterConfiguration {
|
public abstract static class Config implements LookupDataAdapterConfiguration {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@JsonProperty(TYPE_FIELD)
|
@JsonProperty(TYPE_FIELD)
|
||||||
@ -470,6 +472,11 @@ public class RedisLookupDataAdapter extends LookupDataAdapter {
|
|||||||
|
|
||||||
@AutoValue.Builder
|
@AutoValue.Builder
|
||||||
public abstract static class Builder {
|
public abstract static class Builder {
|
||||||
|
@JsonCreator
|
||||||
|
public static Builder create() {
|
||||||
|
return Config.builder();
|
||||||
|
}
|
||||||
|
|
||||||
@JsonProperty(TYPE_FIELD)
|
@JsonProperty(TYPE_FIELD)
|
||||||
public abstract Builder type(String type);
|
public abstract Builder type(String type);
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ import org.graylog2.plugin.lookup.LookupResult;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.google.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
public class RedisLookupPluginFunction extends LookupTableFunction<GenericLookupResult> {
|
public class RedisLookupPluginFunction extends LookupTableFunction<GenericLookupResult> {
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
in.nosd.redis.RedisLookupPlugin
|
in.nosd.redis.RedisLookupPluginPlugin
|
@ -14,6 +14,7 @@
|
|||||||
* along with this program. If not, see
|
* along with this program. If not, see
|
||||||
* <http://www.mongodb.com/licensing/server-side-public-license>.
|
* <http://www.mongodb.com/licensing/server-side-public-license>.
|
||||||
*/
|
*/
|
||||||
|
/* eslint-disable react/no-unescaped-entities, no-template-curly-in-string */
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
class RedisLookupAdapterDocumentation extends React.Component {
|
class RedisLookupAdapterDocumentation extends React.Component {
|
||||||
|
@ -112,4 +112,5 @@ class RedisLookupAdapterFieldSet extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export default RedisLookupAdapterFieldSet;
|
export default RedisLookupAdapterFieldSet;
|
||||||
|
@ -19,6 +19,6 @@ const { PluginWebpackConfig } = require('graylog-web-plugin');
|
|||||||
const { loadBuildConfig } = require('graylog-web-plugin');
|
const { loadBuildConfig } = require('graylog-web-plugin');
|
||||||
|
|
||||||
// Remember to use the same name here and in `getUniqueId()` in the java MetaData class
|
// Remember to use the same name here and in `getUniqueId()` in the java MetaData class
|
||||||
module.exports = new PluginWebpackConfig(__dirname, 'in.nosd.redis.RedisLookupPlugin', loadBuildConfig(path.resolve(__dirname, './build.config')), {
|
module.exports = new PluginWebpackConfig(__dirname, 'in.nosd.redis.RedisLookupPluginPlugin', loadBuildConfig(path.resolve(__dirname, './build.config')), {
|
||||||
// Here goes your additional webpack configuration.
|
// Here goes your additional webpack configuration.
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user