Skip to main content
Sumo Logic

Collect Cassandra Logs and Metrics for Non-Kubernetes environments

This page provides instructions for configuring log and metric collection for the Sumo Logic App for Cassandra.

We use the Telegraf operator for Cassandra metric collection and Sumo Logic Installed Collector for collecting Cassandra logs. The diagram below illustrates the components of the Cassandra collection in a non-Kubernetes environment. Telegraf runs on the same system as Cassandra, and uses the Jolokia2 input plugin to obtain Cassandra metrics, and the Sumo Logic output plugin to send the metrics to Sumo Logic. Logs from Cassandra on the other hand are sent to a Sumo Logic Local File source.

This section provides instructions for configuring metrics collection for the Sumo Logic App for Cassandra. Follow the below instructions to set up the metric collection:

  1. Configure Metrics Collection

    1. Configure a Hosted Collector

    2. Configure an HTTP Logs and Metrics Source

    3. Install Telegraf

    4. Configure and start Telegraf

  2. Configure Logs Collection

    1. Configure logging in Cassandra

    2. Configure Sumo Logic Installed Collector

Step 1 Configure Metrics Collection

  1. Configure a Hosted Collector

To create a new Sumo Logic hosted collector, perform the steps in the Configure a Hosted Collector section of the Sumo Logic documentation.

  1. Configure an HTTP Logs and Metrics Source

Create a new HTTP Logs and Metrics Source in the hosted collector created above by following these instructions. Make a note of the HTTP Source URL.

  1. Install Telegraf

Use the following steps to install Telegraf.

  1. Configure and start Telegraf

As part of collecting metrics data from Telegraf, we will use the jolokia2 input plugin to get data from Telegraf and the Sumo Logic output plugin to send data to Sumo Logic. 

Create or modify telegraf.conf and copy and paste the text below:  

[[inputs.jolokia2_agent]]
  urls = ["http://localhost:8778/jolokia"]
  name_prefix = "cassandra_java_"
[inputs.jolokia2_agent.tags]
  environment="<Your_Environment_Name>"
  component="database"
  db_system="cassandra"
  db_cluster="<Your_Cassandra_Cluster_Name>"
  dc = "IDC1"
  [[inputs.jolokia2_agent.metric]]
    name  = "Memory"
    mbean = "java.lang:type=Memory"
  [[inputs.jolokia2_agent.metric]]
    name  = "GarbageCollector"
    mbean = "java.lang:name=*,type=GarbageCollector"
    tag_keys = ["name"]
    field_prefix = "$1_"
[[inputs.jolokia2_agent]]
  urls = ["http://localhost:8778/jolokia"]
  name_prefix = "cassandra_"
[inputs.jolokia2_agent.tags]
  environment="<Your_Environment_Name>"
  component="database"
  db_system="cassandra"
  db_cluster="<Your_Cassandra_Cluster_Name>"
  dc = "IDC1"
  [[inputs.jolokia2_agent.metric]]
    name  = "TableMetrics"
    mbean = "org.apache.cassandra.metrics:name=*,scope=*,keyspace=*,type=Table"
    tag_keys = ["name", "scope","keyspace"]
    field_prefix = "$1_"
  [[inputs.jolokia2_agent.metric]]
    name = "DroppedMessageMetrics"
    mbean = "org.apache.cassandra.metrics:name=*,scope=*,type=DroppedMessage"
    tag_keys = ["name", "scope"]
    field_prefix = "$1_"
  [[inputs.jolokia2_agent.metric]]
    name = "ClientMetrics"
    mbean = "org.apache.cassandra.metrics:type=Client,name=*"
    tag_keys = ["name"]
    field_prefix = "$1_"
  [[inputs.jolokia2_agent.metric]]
    name = "ThreadPoolMetrics"
    mbean = "org.apache.cassandra.metrics:type=ThreadPools,path=*,scope=*,name=*"
    tag_keys = ["name", "scope", "path"]
    field_prefix = "$1_"
  [[inputs.jolokia2_agent.metric]]
    name = "CacheMetrics"
    mbean = "org.apache.cassandra.metrics:type=Cache,scope=*,name=*"
    tag_keys = ["name", "scope"]
    field_prefix = "$1_"
  [[inputs.jolokia2_agent.metric]]
    name = "CommitLogMetrics"
    mbean = "org.apache.cassandra.metrics:type=CommitLog,name=*"
    tag_keys = ["name"]
    field_prefix = "$1_"
[[outputs.sumologic]]
  url = "<URL Created in Step 3>”
  data_format = "prometheus"
 [outputs.sumologic.tagpass]
    db_cluster=["<Your_Cassandra_Cluster_Name>"]

Please enter values for the following parameters (marked in bold above):

  • In the input plugins section, which is [[inputs. jolokia2_agent]]:
    • urls - The URL to the jolokia server. Please see this doc for more information on additional parameters for configuring the Cassandra input plugin for Telegraf.
  • In the tags section, which is [inputs.Cassandra.tags]:
    • environment - This is the deployment environment where the Cassandra cluster identified by the value of servers resides. For example: dev, prod or qa. While this value is optional we highly recommend setting it. 
    • db_cluster - Enter a name to identify this Cassandra cluster. This cluster name will be shown in the Sumo Logic dashboards. 
  • In the output plugins section, which is [[outputs.sumologic]]
    • url - This is the HTTP source URL created in step 3. Please see this doc for more information on additional parameters for configuring the Sumo Logic Telegraf output plugin.

Here’s an explanation for additional values set by this Telegraf configuration that we request you please do not modify as they will cause the Sumo Logic apps to not function correctly.

  • data_format - “prometheus” In the output plugins section, which is [[outputs.sumologic]]. Metrics are sent in the Prometheus format to Sumo Logic
  • db_system: “cassandra” - In the input plugins section:  This value identifies the database system.
  • component: “database” - In the input plugins section: This value identifies application components.
  • For all other parameters please see this doc for more properties that can be configured in the Telegraf agent globally.

Once you have finalized your telegraf.conf file, you can start or reload the telegraf service using instructions from the doc.

At this point, Cassandra metrics should start flowing into Sumo Logic.

Step 2 Configure Logs Collection

This section provides instructions for configuring log collection for Cassandra running on a non-kubernetes environment for the Sumo Logic App for Cassandra. 

By default, Cassandra logs are stored in a log file. 

Sumo Logic supports collecting logs from a local log file by using a local file source via Installed collectors. The installed collector will require you to allow outbound traffic to Sumo Logic endpoints for collection to work. For detailed requirements for Installed collectors, see this page.

Based on your infrastructure and networking setup choose one of these methods to collect Cassandra logs and follow the instructions below to set up log collection:

  1. Configure logging in Cassandra

Cassandra supports logging via the local text log files. Cassandra logs have the following levels of verbosity. To select a level, set loglevel to one of:

  • ALL
  • TRACE
  • DEBUG
  • INFO (Default)
  • WARN
  • ERROR
  • OFF

To add debug logging to a class permanently using the logback framework, use nodetool setlogginglevel to check you have the right class before you set it in the logback.xml file in install_location/conf. Modify to include the following line or similar at the end of the file:

<logger name="org.apache.cassandra.gms.FailureDetector" level="DEBUG"/>

Restart the node to invoke the change.

  1. Configure Cassandra to log to a Local file

Cassandra provides logging functionality using Simple Logging Facade for Java (SLF4J) with a logback backend. Cassandra has three main logs, the system.log, debug.log, and gc.log which hold general logging messages, debugging logging messages, and java garbage collection logs respectively.

These logs by default live in ${CASSANDRA_HOME}/logs, but most Linux distributions relocate logs to /var/log/cassandra. Operators can tune this location as well as what levels are logged using the provided logback.xml file.

You can configure logging programmatically or manually. Manual ways to configure logging are:

  • Run the nodetool setlogginglevel command.
  • Configure the logback-test.xml or logback.xml file installed with Cassandra.
  • Use the JConsole tool to configure logging through JMX.

Logs from the Cassandra log file can be collected via a Sumo Logic Installed collector and a Local File Source as explained in the next section.

  1. Configuring a Collector

To add an Installed collector, perform the steps as defined on the page Configure an Installed Collector.

  1. Configuring a Source

To add a Local File Source source for Cassandra do the following

To collect logs directly from your Cassandra machine, use an Installed Collector and a Local File Source. 

  1. Add a Local File Source.

  2. Configure the Local File Source fields as follows:

  • Name. (Required)
  • Description. (Optional)
  • File Path (Required). Enter the path to your log files. The files are typically located in /var/log/cassandra/system.log. If you are using a customized path, check the logback.xml file for this information. 
  • Source Host. Sumo Logic uses the hostname assigned by the OS unless you enter a different host name
  • Source Category. Enter any string to tag the output collected from this Source, such as Cassandra/Logs. (The Source Category metadata field is a fundamental building block to organize and label Sources. For details see Best Practices.)
    • Fields. Set the following fields:
    • component = database
    • db_system = cassandra
    • db_cluster = <Your_Cassandra_Cluster_Name>
    • environment = <Environment_Name>, such as Dev, QA or Prod.

  1. Configure the Advanced section:

  • Enable Timestamp Parsing. Select Extract timestamp information from log file entries.
  • Time Zone. Choose the option, Ignore time zone from log file and instead use, and then select your Cassandra Server’s time zone.
  • Timestamp Format. The timestamp format is automatically detected.
  • Encoding. Select UTF-8 (Default).
  • Enable Multiline Processing. Detect messages spanning multiple lines
    • Infer Boundaries - Detect message boundaries automatically
  1. Click Save.

At this point, Cassandra logs should start flowing into Sumo Logic.