We use the Telegraf operator for Memcached metric collection and Sumo Logic Installed Collector for collecting Memcached logs. The diagram below illustrates the components of the Memcached collection in a non-Kubernetes environment. Telegraf runs on the same system as Memcached and uses the Memcached input plugin to obtain Memcached metrics. The Sumo Logic output plugin to send the metrics to Sumo Logic. Logs from Memcached on the other hand are sent to a Sumo Logic Local File source.
This section provides instructions for configuring logs and metrics collection for the Sumo Logic App for Memcached. Follow the below instructions to set up the logs and metrics collection:
- Configure Metrics Collection
- Configure a Hosted Collector
- Configure an HTTP Logs and Metrics Source
- Install Telegraf
- Configure and start Telegraf
- Configure Logs Collection
- Configure logging in Memcached
- Configure Sumo Logic Installed Collector
Step 1 Configure Metrics Collection
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.
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.
Use the following steps to install Telegraf.
Configure and start Telegraf
As part of collecting metrics data from Telegraf, we will use the Memcached input plugin to get data from Telegraf and the Sumo Logic output plugin to send data to Sumo Logic.
Create or modify
telegraf.confand copy and paste the text below:
servers = ["localhost:11211"] [inputs.memcached.tags] environment="dev_CHANGE_ME" component="database" db_system="memcached" db_cluster="memcached_on_premise_CHANGE_ME" url = "<URL Created in Step 3_CHANGEME>” data_format = "prometheus"
Please enter values for the following parameters (marked in bold_CHANGE_ME above):
In the input plugins section which is
servers- An array of addresses to gather stats about. Specify an IP on hostname. Please see this doc for more information on additional parameters for configuring the Memcached input plugin for Telegraf.
In the tags section which is
environment - This is the deployment environment where the Memcached 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 Memcached cluster. This cluster name will be shown in the Sumo Logic dashboards.
In the output plugins section which is
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 i.e. Metrics are sent in the Prometheus format to Sumo Logic
component: “database” - In the input plugins section i.e. - This value is used by Sumo Logic apps to identify 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, Memcached metrics should start flowing into Sumo Logic.
Step 2 Configure Logs Collection
This section provides instructions for configuring log collection for Memcached running on a non-kubernetes environment for the Sumo Logic App for Memcached.
By default, Memcached logs are stored in a log file. Local log files can be collected via Installed collectors. An 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.
Configure logging in Memcached
By default, the installation of Memcached will not write any request logs to disk.
To add a log file for Memcached, you can use the following syntax:
memcached -d -m 3072 -l localhost -p 11211 -u nobody -v 2>>/var/log/memcached/memcached.log
if you’re on RHEL/CentOS, you can edit the file
PORT="11211" USER="memcached" MAXCONN="3048" CACHESIZE="256" OPTIONS="-vv >> /var/log/memcached/memcached.log 2>&1"
Save the file, restart Memcached.
Configuring a Collector
To collect logs directly from the Memcached machine, configure an Installed Collector.
Configuring a Source
To collect logs directly from your Memcached machine, use an Installed Collector and a Local File Source.
- Add a Local File Source.
- Configure the Local File Source fields as follows:
- Name. (Required)
- Description. (Optional)
- File Path (Required). Enter the path to your error.log or access.log. The files are typically located in
/var/log/memcached/memcached.log. If you are using a customized path, check the
Memcached.conffile for this information.
- Source Host. Sumo Logic uses the hostname assigned by the OS unless you enter a different hostname
- Source Category. Enter any string to tag the output collected from this Source, such as Memcached/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 = memcached
- db_cluster = <Your_Memcached_Cluster_Name>
- environment = <Environment_Name>, such as Dev, QA or Prod.
- 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 Memcached 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
- Click Save.
At this point, Memcached logs should start flowing into Sumo Logic.