b2c-webdav
Salesforce B2C Commerce WebDAV file operations (listing, upload, download, logs) Skill
When & Why to Use This Skill
This Claude skill provides a comprehensive interface for managing Salesforce B2C Commerce WebDAV operations via the b2c CLI. It streamlines essential developer and DevOps workflows by enabling efficient file transfers, directory management, and advanced log analysis across multiple WebDAV roots such as impex, cartridges, and logs. By automating manual WebDAV tasks, it significantly accelerates troubleshooting and deployment processes within the Salesforce Commerce Cloud ecosystem.
Use Cases
- Log Analysis & Troubleshooting: Rapidly search and filter through 'customerror', 'fatal', or 'security' logs using CLI commands to identify production issues without manual file downloads.
- Automated Deployment: Streamline the process of uploading code cartridges or static resources to specific instance roots during CI/CD or development cycles.
- Data Maintenance: Manage large Import/Export (impex) files, including zipping remote directories for backup or unzipping data packages directly on the server.
- System Health Monitoring: Access and audit system-specific logs like 'quota' or 'deprecation' to ensure platform compliance and prevent performance bottlenecks.
- Security Auditing: Retrieve and inspect security logs to monitor authentication events and login activities across different commerce instances.
| name | b2c-webdav |
|---|---|
| description | Using the b2c CLI for WebDAV file operations (listing, upload, download, logs) |
B2C WebDAV Skill
Use the b2c CLI plugin to perform WebDAV file operations on Salesforce B2C Commerce instances. This includes listing files, uploading, downloading, and managing files across different WebDAV roots.
WebDAV Roots
The --root flag specifies the WebDAV directory:
impex(default) - Import/Export directorytemp- Temporary filescartridges- Code cartridgesrealmdata- Realm datacatalogs- Product catalogslibraries- Content librariesstatic- Static resourceslogs- Application logssecuritylogs- Security logs
Examples
List Files
# list files in the default IMPEX root
b2c webdav ls
# list files in a specific path
b2c webdav ls src/instance
# list files in the cartridges root
b2c webdav ls --root=cartridges
# list files with JSON output
b2c webdav ls --root=impex --json
Reading Log Files
Use the logs root to access instance log files:
# list all log files
b2c webdav ls --root=logs
# list log files with JSON output for parsing
b2c webdav ls --root=logs --json
# download a specific log file (e.g., customerror log)
b2c webdav get customerror-blade0-1-appserver-20240115.log --root=logs
# download a log file to a specific local path
b2c webdav get error-blade0-1-appserver-20240115.log --root=logs -o ./downloads/error.log
# output log file content to stdout (for piping to grep, etc.)
b2c webdav get customerror-blade0-1-appserver-20240115.log --root=logs -o -
# pipe log content to grep to search for errors
b2c webdav get customerror-blade0-1-appserver-20240115.log --root=logs -o - | grep "OrderNo"
# download security logs
b2c webdav ls --root=securitylogs
b2c webdav get security-blade0-1-20240115.log --root=securitylogs
# list archived logs (compressed after 3 days)
b2c webdav ls log_archive --root=logs
Log File Reference
Log File Naming Pattern
Log files follow this naming pattern:
<type>-<hostname>-appserver-<date>.log
Example: customerror-blade0-1-appserver-20240115.log
Custom Log File Types
Files generated by script logging (dw.system.Logger):
| Log Type | Generated By | Default State |
|---|---|---|
customdebug |
Logger.debug() / log.debug() |
Disabled |
custominfo |
Logger.info() / log.info() |
Disabled |
customwarn |
Logger.warn() / log.warn() |
Always enabled |
customerror |
Logger.error() / log.error() |
Always enabled |
customfatal |
log.fatal() |
Always enabled |
Custom Named Log Files
Created with Logger.getLogger(prefix, category):
custom-<prefix>-<hostname>-appserver-<date>.log
Example: custom-orderexport-blade0-1-appserver-20240115.log
# list custom named log files
b2c webdav ls --root=logs | grep "custom-orderexport"
# download a custom named log
b2c webdav get custom-orderexport-blade0-1-appserver-20240115.log --root=logs
System Log File Types
| Log Type | Description |
|---|---|
error |
System errors in scripts, templates, platform |
warn |
Lock status, slot warnings, servlet warnings |
info |
System information |
debug |
Debug information (when enabled) |
fatal |
Critical system failures |
api |
API problems and violations |
deprecation |
Usage of deprecated APIs |
jobs |
Job status information |
staging |
Replication process information |
quota |
Quota warnings and limit violations |
sql |
SQL and replication issues |
syslog |
API processing, staging, import/export |
sysevent |
Appserver registration, cartridge logs |
Log Retention and Archives
| Location | Retention |
|---|---|
/Logs/ |
Current logs (< 3 days old) |
/Logs/log_archive/ |
Compressed logs (3-30 days) |
| Production/Staging | 30 days |
| Security logs | 90 days |
# list current logs
b2c webdav ls --root=logs
# list archived (gzipped) logs
b2c webdav ls log_archive --root=logs
# download archived log
b2c webdav get log_archive/customerror-blade0-1-appserver-20240112.log.gz --root=logs
Security Logs
Security logs track authentication events:
# list security logs
b2c webdav ls --root=securitylogs
# download security log
b2c webdav get security-blade0-1-20240115.log --root=securitylogs -o - | grep "LOGIN"
Import/Export Logs
Located in IMPEX root under /log/:
# list import/export logs
b2c webdav ls log --root=impex
# download catalog import log
b2c webdav get log/Catalog-Import-20240115.log --root=impex
Common Log Queries
# find recent error logs
b2c webdav ls --root=logs | grep customerror
# search for specific order in error log
b2c webdav get customerror-blade0-1-appserver-20240115.log --root=logs -o - | grep "ORD12345"
# search for payment errors
b2c webdav get customerror-blade0-1-appserver-20240115.log --root=logs -o - | grep -i "payment"
# check job failures
b2c webdav get jobs-blade0-1-appserver-20240115.log --root=logs -o - | grep -i "failed"
# check quota warnings
b2c webdav get quota-blade0-1-appserver-20240115.log --root=logs -o - | grep "exceeded"
# check deprecated API usage
b2c webdav get deprecation-blade0-1-appserver-20240115.log --root=logs
Download Files
# download a file from IMPEX (default root)
b2c webdav get src/instance/export.zip
# download to a specific local path
b2c webdav get src/instance/export.zip -o ./downloads/export.zip
# download from a specific root
b2c webdav get customerror.log --root=logs
# output file content to stdout
b2c webdav get src/instance/data.xml -o -
Upload Files
# upload a file to IMPEX
b2c webdav put ./local-file.zip src/instance/
# upload to a specific root
b2c webdav put ./my-cartridge.zip --root=cartridges
Create Directories
# create a directory in IMPEX
b2c webdav mkdir src/instance/my-folder
# create a directory in a specific root
b2c webdav mkdir my-folder --root=temp
Delete Files
# delete a file
b2c webdav rm src/instance/old-export.zip
# delete from a specific root
b2c webdav rm old-file.txt --root=temp
Zip/Unzip Remote Files
# create a zip archive of a remote directory
b2c webdav zip src/instance/my-folder
# extract a remote zip archive
b2c webdav unzip src/instance/archive.zip
More Commands
See b2c webdav --help for a full list of available commands and options in the webdav topic.