openmindlab / cctail Goto Github PK
View Code? Open in Web Editor NEWSalesforce Commerce Cloud logs remote tail
License: MIT License
Salesforce Commerce Cloud logs remote tail
License: MIT License
Hi There,
I wonder if you have considered pulling the security logs (/on/demandware.servlet/webdav/Sites/Securitylogs) at all?
https://documentation.b2c.commercecloud.salesforce.com/DOC4/index.jsp?topic=%2Fcom.demandware.dochelp%2Fcontent%2Fb2c_commerce%2Ftopics%2Fsite_development%2Fb2c_understanding_log_files.html
I think they would be useful to our use case but I don't see any reference to them in the current logging time. Forgive me if i've missed something.
Many thanks.
George
Hi @fgiust ! I'm excited to use cctail
, I'm actually looking into having it pipe the logs to an ingestion tool like fluentd, but that's besides the point right now. ;) For right now though, I'm just playing with it to see how it works today. For an SFCC sandbox for which I don't have an API Client create yet, I tried my personal client_id and secret_id. I would expect this to fail since it is expecting an API Client creds. However when I run it this way, it doesn't throw any 401 failures, it just comes back with an empty log list, like this:
seth:cctail $ node dist/cctail.js
cctail - v1.2.0 - (c) openmind
Authenticating using oauth - client_id REDACTED
✔ Select logs on [REDACTED.demandware.net] ›
No log selected, exiting.
I added a couple log messages to logfetcher.ts
to see what's going on, here's the result:
seth:cctail $ node dist/cctail.js
cctail - v1.2.0 - (c) openmind
Authenticating using oauth - client_id REDACTED
Response:
{
error_description: 'Client authentication failed',
error: 'invalid_client'
}
Status Code: 401
Response:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>401 - Authorization Required.</title>
<link rel="STYLESHEET" type="text/css" href="/waroot/style.css">
</head>
<body>
<h1>Authorization Required</h1>
<img src="/waroot/system_arrow.gif" width="21" height="21" alt="" border="0">
<p class="system_info">
This request requires HTTP authentication.
</p>
<hr>
</body>
</html>
Status Code: 401
✔ Select logs on [REDACTED.demandware.net] ›
No log selected, exiting.
So it seems the Axios requests are getting 401 errors back (which I would expect!), but the catch
blocks aren't catching them. I'll keep playing with the code, I suspect it's because it's to do with await
or how Axios handles error codes.
We have created 7 different docker containers for pulling different log types but we could see duplicates in the NR as each container is pulling all the other log types as well rather the ones mentioned in the config file
these are the different log types used by each different containers
"log_types": ["customwarn", "warn"]
"log_types": ["customerror", "customfatal"]
log_types: ["error", "fatal"]
"log_types": ["sysevent", "syslog", "system"]
"log_types": ["service", "jobs"]
"log_types": ["custom"]
log_types: ["custominfo", "info"]
The sample config file of cctail is below::
/ # cat ./log.conf.json
{
"profiles": {
"sfcc": {
"hostname": "ENV_SFCC_HOSTNAME",
"client_id": "ENV_SFCC_CLIENT_ID",
"client_secret": "ENV_SFCC_CLIENT_SECRET",
"polling_interval": 30,
"log_types": ["service", "jobs"]
}
},
"interactive": false,
"fluent": {
"enabled": true
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.