当前位置: 首页>>代码示例>>Java>>正文


Java Configuration.getString方法代码示例

本文整理汇总了Java中org.graylog2.plugin.configuration.Configuration.getString方法的典型用法代码示例。如果您正苦于以下问题:Java Configuration.getString方法的具体用法?Java Configuration.getString怎么用?Java Configuration.getString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.graylog2.plugin.configuration.Configuration的用法示例。


在下文中一共展示了Configuration.getString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: GraylogPluginDatadog

import org.graylog2.plugin.configuration.Configuration; //导入方法依赖的package包/类
@Inject
public GraylogPluginDatadog(@Assisted Stream stream, @Assisted Configuration configuration) throws MessageOutputConfigurationException {
    this.configuration = configuration;

    tags = configuration.getString(CK_DATADOG_TAGS, "").split(",");
    priority = configuration.getString(CK_DATADOG_PRIORITY, "normal");
    alertType = configuration.getString(CK_DATADOG_ALERT_TYPE, "info");
    aggregationKey = configuration.getString(CK_DATADOG_AGGREGATION_KEY, "");

    try {
        eventUrl = new URI(String.format("%s?api_key=%s&app_key=%s",
                                         DATADOG_API_URL,
                                         configuration.getString(CK_DATADOG_API_KEY),
                                         configuration.getString(CK_DATADOG_APP_KEY)));
    } catch (URISyntaxException e){
        throw new MessageOutputConfigurationException("Syntax error in datadog event URL");
    }

    Client client = ClientBuilder.newClient();
    eventTarget = client.target(eventUrl);
    isRunning.set(true);
}
 
开发者ID:underdogio,项目名称:graylog-plugin-datadog,代码行数:23,代码来源:GraylogPluginDatadog.java

示例2: FileOutput

import org.graylog2.plugin.configuration.Configuration; //导入方法依赖的package包/类
@Inject
public FileOutput(@Assisted Stream stream , @Assisted Configuration conf){

    String output_folder = conf.getString(CK_OUTPUT_FOLDER);
    String file_name = conf.getString(CK_OUTPUT_FILE);
    String full_file_name = output_folder + "/" + file_name ;
    file = new File(full_file_name);
    Integer flush_time=5;
    try {
        flush_time = conf.getInt(CK_FLUSH_TIME);
    } catch (Exception e) {
    }

    shutdown = false;
    messageBuffer="";

    Timer timer = new Timer();
    WriteBuffer wb = new WriteBuffer(this);

    LOG.info(" File Output Plugin has been configured with the following parameters:");
    LOG.info(CK_OUTPUT_FOLDER + " : " + output_folder );
    LOG.info(CK_OUTPUT_FILE + " : " + file_name );
    LOG.info(CK_FLUSH_TIME + " : " + flush_time );

    timer.scheduleAtFixedRate(wb, 0, flush_time * 1000);

}
 
开发者ID:scampuza,项目名称:graylog-plugin-file-output,代码行数:28,代码来源:FileOutput.java

示例3: GELFRedisOutput

import org.graylog2.plugin.configuration.Configuration; //导入方法依赖的package包/类
@Inject
public GELFRedisOutput(@Assisted Configuration configuration, ServerStatus serverStatus) throws MessageOutputConfigurationException {
    this(
            new RedisClientBuilder(configuration).buildClient(),
            configuration.getString(CK_CHANNEL, "graylog"),
            serverStatus.getNodeId().toString(),
            serverStatus.getClusterId()
    );
}
 
开发者ID:graylog-labs,项目名称:graylog-plugin-redis,代码行数:10,代码来源:GELFRedisOutput.java

示例4: WebHDFSOutput

import org.graylog2.plugin.configuration.Configuration; //导入方法依赖的package包/类
@Inject
public WebHDFSOutput(@Assisted Stream stream, @Assisted Configuration configuration)
        throws MessageOutputConfigurationException, IOException {
    this.configuration = configuration;

    LOG.info("WebHDFSOutput launching...");

    String hostname = configuration.getString(CK_HDFS_HOST_NAME);
    int port = configuration.getInt(CK_HDFS_PORT);
    String username = configuration.getString(CK_USERNAME);

    hdfsConnection = new WebHDFSConnection("http://" + hostname + ":" + port, username, "anything",
            AuthenticationType.PSEUDO);

    messagesToWrite = new LinkedList<>();


    fileToWrite = configuration.getString(CK_FILE);
    if(fileToWrite.contains("%")) {
        fileToWrite = fileToWrite.replaceAll("%","%1\\$t");
    }
    messageFormat = configuration.getString(CK_MESSAGE_FORMAT);
    flushIntervalInMillis = configuration.getInt(CK_FLUSH_INTERVAL) * 1000;

    if(flushIntervalInMillis > 0) {
        flushTimer = new Timer("WebHDFS-Flush-Timer", true);
        flushTask = createFlushTask();
        flushTimer.schedule(flushTask, flushIntervalInMillis, flushIntervalInMillis);
    }

    //append = configuration.getBoolean(CK_APPEND);
    isRunning.set(true);
    LOG.info("WebHDFSOutput launched");
}
 
开发者ID:sivasamyk,项目名称:graylog-plugin-output-webhdfs,代码行数:35,代码来源:WebHDFSOutput.java

示例5: NetFlowCodec

import org.graylog2.plugin.configuration.Configuration; //导入方法依赖的package包/类
@Inject
protected NetFlowCodec(@Assisted Configuration configuration, NetflowV9CodecAggregator netflowV9CodecAggregator) throws IOException {
    super(configuration);
    this.netflowV9CodecAggregator = netflowV9CodecAggregator;

    final String netFlow9DefinitionsPath = configuration.getString(CK_NETFLOW9_DEFINITION_PATH);
    if (netFlow9DefinitionsPath == null || netFlow9DefinitionsPath.trim().isEmpty()) {
        this.typeRegistry = NetFlowV9FieldTypeRegistry.create();
    } else {
        try (InputStream inputStream = new FileInputStream(netFlow9DefinitionsPath)) {
            this.typeRegistry = NetFlowV9FieldTypeRegistry.create(inputStream);
        }
    }
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-netflow,代码行数:15,代码来源:NetFlowCodec.java

示例6: JDBCOutput

import org.graylog2.plugin.configuration.Configuration; //导入方法依赖的package包/类
@Inject 
public JDBCOutput(@Assisted Stream stream, @Assisted Configuration conf) throws SQLException {
	url = conf.getString("url");
	username = conf.getString("username");
	password = conf.getString("password");
	driver = conf.getString("driver");
	String f = conf.getString("fields");
	if (f != null && !f.trim().equals("")) {
		List<String> l = new ArrayList<String>();
		StringTokenizer tk = new StringTokenizer(f, "\n;, ");
		while (tk.hasMoreTokens()) {
			l.add(tk.nextToken().trim());
		}
		fields = l.toArray(new String[l.size()]);
	}
	logInsertQuery = conf.getString("logInsertQuery");
	logInsertAttributeQuery = conf.getString("logInsertAttributeQuery");
	
	log.info("Creating JDBC output " + url);
	
	if (driver != null && !driver.trim().isEmpty()) {
		try {
			Class.forName(driver);
		} catch (Exception e) {
			log.log(Level.SEVERE, "Failed to find/register driver (" + driver + "): " + e.getMessage(), e);
			driverFailed = true;
		}
	}
	
	reconnect();
}
 
开发者ID:wizecore,项目名称:graylog2-output-jdbc,代码行数:32,代码来源:JDBCOutput.java

示例7: Neo4JBoltTransport

import org.graylog2.plugin.configuration.Configuration; //导入方法依赖的package包/类
public Neo4JBoltTransport(Configuration config) throws MessageOutputConfigurationException {


        configuration = config;
        fields = new LinkedList<String>();;
        Session session = null;

        try {
            driver = GraphDatabase.driver( config.getString(Neo4jOutput.CK_NEO4J_URL),
                    AuthTokens.basic(config.getString(Neo4jOutput.CK_NEO4J_USER), config.getString(Neo4jOutput.CK_NEO4J_PASSWORD)) );
            session = driver.session();

            //run initialization query only once
            String createQueryOnce = config.getString(Neo4jOutput.CK_NEO4J_STARTUP_QUERY);

            if (createQueryOnce.length() > 0)
                session.run(createQueryOnce);
        }
        catch (ClientException e){
            throw new MessageOutputConfigurationException("Malformed neo4j configuration: " + e );
        }
        finally {
            session.close();
        }
        //get message fields needed by cypher query
        String createQuery = config.getString(Neo4jOutput.CK_NEO4J_QUERY);
        LOG.debug("Bolt protocol, create query: " + createQuery);

        Matcher m = Pattern.compile("\\{([^{}]*)\\}").matcher(createQuery);
        while (m.find()) {
            fields.add(m.group(1));
            LOG.debug("Found field in cypher statement: " + m.group(1));
        }
        LOG.info("Identified " + fields.size() + " fields in graph create query.");

        parsedCreateQery = parseQuery(createQuery);


    }
 
开发者ID:mariussturm,项目名称:graylog-plugin-output-neo4j,代码行数:40,代码来源:Neo4JBoltTransport.java

示例8: SplunkOutput

import org.graylog2.plugin.configuration.Configuration; //导入方法依赖的package包/类
@Inject
public SplunkOutput(@Assisted Configuration configuration) throws MessageOutputConfigurationException {
    // Check configuration.
    if (!checkConfiguration(configuration)) {
        throw new MessageOutputConfigurationException("Missing configuration.");
    }

    // Set up sender.
    sender = new TCPSender(
            configuration.getString(CK_SPLUNK_HOST),
            configuration.getInt(CK_SPLUNK_PORT)
    );

    running = true;
}
 
开发者ID:graylog-labs,项目名称:graylog-plugin-splunk,代码行数:16,代码来源:SplunkOutput.java

示例9: login

import org.graylog2.plugin.configuration.Configuration; //导入方法依赖的package包/类
private XMPPConnection login(final Configuration config) throws IOException, XMPPException, SmackException, KeyManagementException, NoSuchAlgorithmException {
    final String serviceName = isNullOrEmpty(config.getString(CK_SERVICE_NAME))
            ? config.getString(CK_HOSTNAME) : config.getString(CK_SERVICE_NAME);

    final XMPPTCPConnectionConfiguration.Builder configBuilder = XMPPTCPConnectionConfiguration.builder()
            .setHost(config.getString(CK_HOSTNAME))
            .setPort(config.getInt(CK_PORT))
            .setServiceName(serviceName)
            .setSendPresence(false);

    if (config.getBoolean(CK_ACCEPT_SELFSIGNED)) {
        TLSUtils.acceptAllCertificates(configBuilder);
    }

    final boolean requireSecurity = config.getBoolean(CK_REQUIRE_SECURITY);
    configBuilder.setSecurityMode(requireSecurity ?
            ConnectionConfiguration.SecurityMode.required : ConnectionConfiguration.SecurityMode.ifpossible);

    final XMPPTCPConnectionConfiguration connectionConfiguration = configBuilder.build();
    if (LOG.isDebugEnabled()) {
        LOG.debug("Supported SASL authentications: {}", SASLAuthentication.getRegisterdSASLMechanisms());
        LOG.debug("require_security: {}", requireSecurity);
        LOG.debug("Security mode: {}", connectionConfiguration.getSecurityMode());
        LOG.debug("Socket factory: {}", connectionConfiguration.getSocketFactory());
        LOG.debug("Keystore: {}", connectionConfiguration.getKeystorePath());
        LOG.debug("Keystore type: {}", connectionConfiguration.getKeystoreType());
    }

    final XMPPTCPConnection xmppConnection = new XMPPTCPConnection(connectionConfiguration);

    xmppConnection.connect();
    xmppConnection.login(config.getString(CK_USERNAME), config.getString(CK_PASSWORD));

    return xmppConnection;
}
 
开发者ID:graylog-labs,项目名称:graylog-plugin-jabber,代码行数:36,代码来源:JabberAlarmCallback.java

示例10: checkUri

import org.graylog2.plugin.configuration.Configuration; //导入方法依赖的package包/类
private static void checkUri(Configuration configuration, String settingName) throws ConfigurationException {
    if (configuration.stringIsSet(settingName)) {
        try {
            final URI uri = new URI(configuration.getString(settingName));
            if (!isValidUriScheme(uri, "http", "https")) {
                throw new ConfigurationException(settingName + " must be a valid HTTP or HTTPS URL.");
            }
        } catch (URISyntaxException e) {
            throw new ConfigurationException("Couldn't parse " + settingName + " correctly.", e);
        }
    }
}
 
开发者ID:graylog-labs,项目名称:graylog-plugin-slack,代码行数:13,代码来源:SlackPluginBase.java

示例11: createSlackMessage

import org.graylog2.plugin.configuration.Configuration; //导入方法依赖的package包/类
protected static SlackMessage createSlackMessage(Configuration configuration, String message) {
    return new SlackMessage(
            configuration.getString(SlackConfiguration.CK_COLOR),
            configuration.getString(SlackConfiguration.CK_ICON_EMOJI),
            configuration.getString(SlackConfiguration.CK_ICON_URL),
            message,
            configuration.getString(SlackConfiguration.CK_USER_NAME),
            configuration.getString(SlackConfiguration.CK_CHANNEL),
            configuration.getBoolean(SlackConfiguration.CK_LINK_NAMES)
    );
}
 
开发者ID:graylog-labs,项目名称:graylog-plugin-slack,代码行数:12,代码来源:SlackPluginBase.java

示例12: if

import org.graylog2.plugin.configuration.Configuration; //导入方法依赖的package包/类
@Inject
public dfchBizExecScript
        (
                @NotNullable @Assisted Stream stream,
                @NotNullable @Assisted Configuration configuration
        )
        throws MessageOutputConfigurationException
{
    try
    {
        LOG.debug("Verifying configuration ...");

        this.configuration = configuration;

        streamTitle = stream.getTitle();
        if(null == streamTitle || streamTitle.isEmpty())
        {
            throw new MessageOutputConfigurationException(String.format("streamTitle: Parameter validation FAILED. Value cannot be null or empty."));
        }
        
        LOG.trace("DF_SCRIPT_ENGINE         : %s\r\n", configuration.getString("DF_SCRIPT_ENGINE"));
        LOG.trace("DF_SCRIPT_PATH_AND_NAME  : %s\r\n", configuration.getString("DF_SCRIPT_PATH_AND_NAME"));
        LOG.trace("DF_DISPLAY_SCRIPT_OUTPUT : %b\r\n", configuration.getBoolean("DF_DISPLAY_SCRIPT_OUTPUT"));
        LOG.trace("DF_SCRIPT_CACHE_CONTENTS : %b\r\n", configuration.getBoolean("DF_SCRIPT_CACHE_CONTENTS"));

        _file = new File(configuration.getString("DF_SCRIPT_PATH_AND_NAME"));
        _scriptEngine = _scriptEngineManager.getEngineByName(configuration.getString("DF_SCRIPT_ENGINE"));
        _scriptContext = _scriptEngine.getContext();

        isRunning.set(true);

        LOG.info("Verifying configuration SUCCEEDED.");
    }
    catch(Exception ex)
    {
        isRunning.set(false);

        LOG.error("*** " + DF_PLUGIN_NAME + "::write() - Exception\r\n" + ex.getMessage() + "\r\n");
        ex.printStackTrace();
    }
}
 
开发者ID:dfch,项目名称:biz.dfch.j.graylog2.plugin.output.execscript,代码行数:42,代码来源:dfchBizExecScript.java

示例13: SlackClient

import org.graylog2.plugin.configuration.Configuration; //导入方法依赖的package包/类
public SlackClient(Configuration configuration) {
    this.webhookUrl = configuration.getString(SlackConfiguration.CK_WEBHOOK_URL);
    this.proxyURL = configuration.getString(SlackConfiguration.CK_PROXY_ADDRESS);
}
 
开发者ID:graylog-labs,项目名称:graylog-plugin-slack,代码行数:5,代码来源:SlackClient.java

示例14: launch

import org.graylog2.plugin.configuration.Configuration; //导入方法依赖的package包/类
@Override
public void launch(MessageInput input) throws MisfireException {
    serverStatus.awaitRunning(() -> lifecycleStateChange(Lifecycle.RUNNING));
    serverEventBus.register(this);

    LOG.debug("Launching MongoDB profiler reader.");
    final Configuration configuration = input.getConfiguration();

    final int port = configuration.getInt(CK_MONGO_PORT);
    final MongoClient mongoClient;
    final List<MongoCredential> credentialList;
    final String db = configuration.getString(CK_MONGO_DB);
    if (configuration.getBoolean(CK_MONGO_USE_AUTH)) {
        final MongoCredential credentials = MongoCredential.createCredential(
                configuration.getString(CK_MONGO_USER),
                db,
                configuration.getString(CK_MONGO_PW).toCharArray()
        );

        credentialList = ImmutableList.of(credentials);
    } else {
        credentialList = ImmutableList.of();
    }

    final String mongoHost = configuration.getString(CK_MONGO_HOST);
    final String[] hosts = mongoHost.split(",");
    final List<ServerAddress> replicaHosts = new ArrayList<>(hosts.length);
    for (String host : hosts) {
        replicaHosts.add(new ServerAddress(host, port));
    }
    mongoClient = new MongoClient(replicaHosts, credentialList);

    // Try the connection.
    try {
        mongoClient.getDB(db).getStats();
    } catch (Exception e) {
        throw new MisfireException("Could not verify MongoDB profiler connection.", e);
    }

    subscriber = new ProfileSubscriber(mongoClient, db, input, localRegistry);
    subscriber.start();
}
 
开发者ID:graylog-labs,项目名称:graylog-plugin-mongodb-profiler,代码行数:43,代码来源:MongoDBProfilerTransport.java

示例15: TcpLogstashOutput

import org.graylog2.plugin.configuration.Configuration; //导入方法依赖的package包/类
@Inject
public TcpLogstashOutput(@Assisted Stream stream, @Assisted Configuration configuration) {

    this(configuration.getString(CK_HOST), configuration.getInt(CK_PORT), configuration.getInt(CK_WORKERS));


}
 
开发者ID:comsysto,项目名称:graylog-logstash-tcp-output,代码行数:8,代码来源:TcpLogstashOutput.java


注:本文中的org.graylog2.plugin.configuration.Configuration.getString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。