A Docker image purpose-built to monitor Salesforce Commerce Cloud (fka Demandware) logs using New Relic Logs.
This image contains 2 processes to collect, process and send these logs to New Relic:
- cctail - a node.js app used to tail and consolidate logs from any SFCC host via WebDAV.
- FluentD - an open source data collector for unified logging layer.
- fluent-plugin-newrelic - New Relic's official FluentD plugin to send log events to the New Relic Logs endpoint.
- fluent-grok-parser - Fluentd's official plugin that enables Logstash's Grok-like parsing logic.
- Use
git
to clone this repository into a suitable folder:
git clone https://github.com/newrelic-experimental/newrelic-logs-for-salesforce-commerce-cloud.git nr-logs-for-sfcc
- Use
docker
to build a container from this image:
docker build -t 'nr-logs-for-sfcc:latest' ./nr-logs-for-sfcc
- Get the License Key for your account, which can be found here
- Use the following docker command to run your container.
docker run -d -e "NEWRELIC_API_KEY=<your_license_key>" -e "SFCC_HOSTNAME=<your_sfcc_host>" -e "SFCC_CLIENT_ID=<your_sfcc_client_id>" -e "SFCC_CLIENT_SECRET=<your_sfcc_client_secret>" nr-logs-for-sfcc:latest
- If you prefer to store these environment variables in a file like this example, you can run docker like so:
docker run -d --env-file=sfcc.env nr-logs-for-sfcc:latest
- Login to New Relic and open the Logs UI, look for entries with
sfcc.xxxx
as their service_name.
If you are not seeing any logs in New Relic Logs:
- Wait a few minutes! As there are a couple steps between your logs and New Relic, it can take a few minutes for them to start rolling in, especially if you have many different log types or high log volumes.
- Connect to your docker container at command-line and review the logs. All of the pertinent logs (
cctail.log
,fluentd.log
andsupervisord.log
) are found in the root directory. The following example also shows how to get the container ID easily and re-use that for connecting:
thiscontainer=$(docker ps | grep nr-logs-for-sfcc:latest | head -n1 | awk '{print $1;}')
docker exec -t -i $thiscontainer /bin/sh
- What each log will tell you:
fluentd.log
- issues with the New Relic License Key or log parsing rules. Messages like[error]: #0 Response was 403 {}
indicate an invalid or unset key.cctail.log
- issues with your SFCC credentials.supervisord.log
- container-wide issues, i.e. those caused by changes made toDockerfile
,entrypoint.sh
orsupervisord.conf
.
- You can run cctail in Debug Mode, using the
CCTAIL_ARGS
environment variable atdocker run
time. This will send more information intocctail.log
about what logs are being polled, and how many log records are being reported from each.
docker run -d -e "CCTAIL_ARGS=-d" -e "NEWRELIC_API_KEY=<your_license_key>" -e "SFCC_HOSTNAME=<your_sfcc_host>" -e "SFCC_CLIENT_ID=<your_sfcc_client_id>" -e "SFCC_CLIENT_SECRET=<your_sfcc_client_secret>" nr-logs-for-sfcc:latest
or (if using an env file):
docker run -d -e "CCTAIL_ARGS=-d" -env-file=sfcc.env nr-logs-for-sfcc:latest
New Relic has open-sourced this project. This project is provided AS-IS WITHOUT WARRANTY OR DEDICATED SUPPORT. Issues and contributions should be reported to the project here on GitHub. We encourage you to bring your experiences and questions to the Explorers Hub where our community members collaborate on solutions and new ideas.
We encourage your contributions to improve New Relic Logs for Salesforce Commerce Cloud! Keep in mind when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. You only have to sign the CLA one time per project.
If you have any questions, or to execute our corporate CLA, required if your contribution is on behalf of a company, please drop us an email at opensource@newrelic.com.
A note about vulnerabilities
As noted in our security policy, New Relic is committed to the privacy and security of our customers and their data. We believe that providing coordinated disclosure by security researchers and engaging with the security community are important means to achieve our security goals.
If you believe you have found a security vulnerability in this project or any of New Relic's products or websites, we welcome and greatly appreciate you reporting it to New Relic through HackerOne.
New Relic Logs for Salesforce Commerce Cloud is licensed under the Apache 2.0 License.