Package org.graylog2.plugin.indexer.rotation

Examples of org.graylog2.plugin.indexer.rotation.RotationStrategy


        if (messageOutput == null) {
            return data;
        }

        final ConfigurationRequest requestedConfiguration = messageOutput.getRequestedConfiguration();

        if (data.containsKey("configuration")) {
            final Map<String, Object> c = (Map<String, Object>) data.get("configuration");

            for (Map.Entry<String, Object> entry : c.entrySet()) {
                if (requestedConfiguration.getField(entry.getKey()).getAttributes().contains(TextField.Attribute.IS_PASSWORD.toString().toLowerCase())) {
                    c.put(entry.getKey(), "********");
                }
            }
        }

View Full Code Here


    protected Logger getLogger() {
        return LOG;
    }

    protected void checkForRotation() {
        final RotationStrategy rotationStrategy = rotationStrategyProvider.get();

        String currentTarget;
        try {
            currentTarget = deflector.getNewestTargetName();
        } catch (NoTargetIndexException e) {
            LOG.error("Could not find current deflector target. Aborting.", e);
            return;
        }
        final RotationStrategy.Result rotate = rotationStrategy.shouldRotate(currentTarget);
        if (rotate == null) {
            LOG.error("Cannot perform rotation at this moment.");
            return;
        }
        LOG.debug("Rotation strategy result: {}", rotate.getDescription());
View Full Code Here

        rotationStrategy = configuration.getRotationStrategy();
    }

    @Override
    public RotationStrategy get() {
        final RotationStrategy strategy = strategies.get(rotationStrategy);
        if (strategy == null) {
            return strategies.get("count"); // TODO how can we do this in a more flexible way?
        }
        return strategy;
    }
View Full Code Here

    @Test
    public void testFailedRotation() {
        final Provider<RotationStrategy> provider = new Provider<RotationStrategy>() {
            @Override
            public RotationStrategy get() {
                return new RotationStrategy() {
                    @Nullable
                    @Override
                    public Result shouldRotate(String index) {
                        return null;
                    }
View Full Code Here

    @Test
    public void testPerformRotation() throws NoTargetIndexException {
        final Provider<RotationStrategy> provider = new Provider<RotationStrategy>() {
            @Override
            public RotationStrategy get() {
                return new RotationStrategy() {
                    @Nullable
                    @Override
                    public Result shouldRotate(String index) {
                        return new Result() {
                            @Override
View Full Code Here

    @Test
    public void testDontPerformRotation() throws NoTargetIndexException {
        final Provider<RotationStrategy> provider = new Provider<RotationStrategy>() {
            @Override
            public RotationStrategy get() {
                return new RotationStrategy() {
                    @Nullable
                    @Override
                    public Result shouldRotate(String index) {
                        return new Result() {
                            @Override
View Full Code Here

        }

        message.setStreams(streamList);
        message.addFields(fields);

        final MessageInput input;
        if (bean.getSourceInput() != null)
            input = getMessageInput(bean.getSourceInput());
        else
            input = null;
View Full Code Here

    public Response status() {
        /*
         * IMPORTANT!! When implementing permissions for radio: This must be
         *             accessible without authorization. LBs don't do that.
         */
        final LoadBalancerStatus lbStatus = serverStatus.getLifecycle().getLoadbalancerStatus();

        final Response.Status status = lbStatus == LoadBalancerStatus.ALIVE
                ? Response.Status.OK : Response.Status.SERVICE_UNAVAILABLE;

        return Response.status(status)
                .entity(lbStatus.toString().toUpperCase())
                .build();
    }
View Full Code Here

    @PUT @Timed
    @Produces(MediaType.APPLICATION_JSON)
    @Path("/override/{status}")
    public Response override(@PathParam("status") String status) {
        final LoadBalancerStatus lbStatus;
        try {
            lbStatus = LoadBalancerStatus.valueOf(status.toUpperCase());
        } catch(IllegalArgumentException e) {
            throw new WebApplicationException(e, Response.Status.BAD_REQUEST);
        }
View Full Code Here

    @GET @Timed
    @Produces(MediaType.TEXT_PLAIN)
    @ApiOperation(value = "Get status of this graylog2-server node for load balancers. " +
            "Returns either ALIVE with HTTP 200 or DEAD with HTTP 503.")
    public Response status() {
        final LoadBalancerStatus lbStatus = serverStatus.getLifecycle().getLoadbalancerStatus();

        Response.Status status = lbStatus == LoadBalancerStatus.ALIVE
                ? Response.Status.OK : Response.Status.SERVICE_UNAVAILABLE;

        return Response.status(status)
                .entity(lbStatus.toString().toUpperCase())
                .build();
    }
View Full Code Here

TOP

Related Classes of org.graylog2.plugin.indexer.rotation.RotationStrategy

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.