Search in sources :

Example 1 with FullQueryLoggerOptions

use of org.apache.cassandra.fql.FullQueryLoggerOptions in project cassandra by apache.

the class StorageService method enableFullQueryLogger.

@Override
public void enableFullQueryLogger(String path, String rollCycle, Boolean blocking, int maxQueueWeight, long maxLogSize, String archiveCommand, int maxArchiveRetries) {
    FullQueryLoggerOptions fqlOptions = DatabaseDescriptor.getFullQueryLogOptions();
    path = path != null ? path : fqlOptions.log_dir;
    rollCycle = rollCycle != null ? rollCycle : fqlOptions.roll_cycle;
    blocking = blocking != null ? blocking : fqlOptions.block;
    maxQueueWeight = maxQueueWeight != Integer.MIN_VALUE ? maxQueueWeight : fqlOptions.max_queue_weight;
    maxLogSize = maxLogSize != Long.MIN_VALUE ? maxLogSize : fqlOptions.max_log_size;
    archiveCommand = archiveCommand != null ? archiveCommand : fqlOptions.archive_command;
    maxArchiveRetries = maxArchiveRetries != Integer.MIN_VALUE ? maxArchiveRetries : fqlOptions.max_archive_retries;
    Preconditions.checkNotNull(path, "cassandra.yaml did not set log_dir and not set as parameter");
    FullQueryLogger.instance.enableWithoutClean(Paths.get(path), rollCycle, blocking, maxQueueWeight, maxLogSize, archiveCommand, maxArchiveRetries);
}
Also used : FullQueryLoggerOptions(org.apache.cassandra.fql.FullQueryLoggerOptions)

Example 2 with FullQueryLoggerOptions

use of org.apache.cassandra.fql.FullQueryLoggerOptions in project cassandra by apache.

the class GetFullQueryLogTest method testDefaultOutput.

@SuppressWarnings("DynamicRegexReplaceableByCompiledPattern")
private void testDefaultOutput(final String getFullQueryLogOutput) {
    final FullQueryLoggerOptions options = new FullQueryLoggerOptions();
    final String output = getFullQueryLogOutput.replaceAll("( )+", " ").trim();
    assertThat(output).contains("enabled false");
    assertThat(output).doesNotContain("log_dir " + temporaryFolder.getRoot().toString());
    assertThat(output).doesNotContain("archive_command /path/to/script.sh %path");
    assertThat(output).contains("roll_cycle " + options.roll_cycle);
    assertThat(output).contains("max_log_size " + options.max_log_size);
    assertThat(output).contains("max_queue_weight " + options.max_queue_weight);
    assertThat(output).contains("max_archive_retries " + options.max_archive_retries);
    assertThat(output).contains("block " + options.block);
}
Also used : FullQueryLoggerOptions(org.apache.cassandra.fql.FullQueryLoggerOptions)

Example 3 with FullQueryLoggerOptions

use of org.apache.cassandra.fql.FullQueryLoggerOptions in project cassandra by apache.

the class GetFullQueryLog method execute.

protected void execute(NodeProbe probe) {
    final TableBuilder tableBuilder = new TableBuilder();
    tableBuilder.add("enabled", Boolean.toString(probe.getStorageService().isFullQueryLogEnabled()));
    final FullQueryLoggerOptions options = probe.getFullQueryLoggerOptions();
    tableBuilder.add("log_dir", options.log_dir);
    tableBuilder.add("archive_command", options.archive_command);
    tableBuilder.add("roll_cycle", options.roll_cycle);
    tableBuilder.add("block", Boolean.toString(options.block));
    tableBuilder.add("max_log_size", Long.toString(options.max_log_size));
    tableBuilder.add("max_queue_weight", Integer.toString(options.max_queue_weight));
    tableBuilder.add("max_archive_retries", Long.toString(options.max_archive_retries));
    tableBuilder.printTo(probe.output().out);
}
Also used : FullQueryLoggerOptions(org.apache.cassandra.fql.FullQueryLoggerOptions) TableBuilder(org.apache.cassandra.tools.nodetool.formatter.TableBuilder)

Aggregations

FullQueryLoggerOptions (org.apache.cassandra.fql.FullQueryLoggerOptions)3 TableBuilder (org.apache.cassandra.tools.nodetool.formatter.TableBuilder)1