<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Karim on Medium]]></title>
        <description><![CDATA[Stories by Karim on Medium]]></description>
        <link>https://medium.com/@lear.karim?source=rss-256efb421804------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*dFL2mGG1fRlnS1pD.jpg</url>
            <title>Stories by Karim on Medium</title>
            <link>https://medium.com/@lear.karim?source=rss-256efb421804------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 12:52:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@lear.karim/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Dockerised WebDAV Client with ELK FileBeat to manage SFCC Logs]]></title>
            <link>https://medium.com/@lear.karim/dockerised-webdav-client-with-elk-filebeat-to-manage-sfcc-logs-c465d472ea0d?source=rss-256efb421804------2</link>
            <guid isPermaLink="false">https://medium.com/p/c465d472ea0d</guid>
            <category><![CDATA[filebeat]]></category>
            <category><![CDATA[elk]]></category>
            <category><![CDATA[sfcc]]></category>
            <category><![CDATA[webdav]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Karim]]></dc:creator>
            <pubDate>Thu, 16 Mar 2023 16:19:06 GMT</pubDate>
            <atom:updated>2023-03-16T16:47:09.648Z</atom:updated>
            <content:encoded><![CDATA[<p>WebDAV, or Web Distributed Authoring and Versioning, is a protocol that extends the HTTP/1.1 protocol to support remote collaborative authoring of web resources. With WebDAV, users can access and modify files on remote servers as if they were on their own computer, making it a popular choice for remote file sharing and content management.</p><p>Every Salesforce B2C Commerce instance includes both an embedded WebDAV server and a WebDAV client. The embedded WebDAV server allows users to access and manage digital assets stored within the Commerce Cloud instance, while the WebDAV client enables users to access and manage digital assets stored outside of the Commerce Cloud instance.</p><p>Log files in Salesforce B2C Commerce, including system logs, custom logs, service logs, and job logs, can be accessed and managed through WebDAV at the following URL: <a href="https://your-instance.demandware.net/on/demandware.servlet/webdav/Sites/Logs/">https://your-instance.demandware.net/on/demandware.servlet/webdav/Sites/Logs/</a>. While Salesforce provides several tools to manage logs, such as the log center, it can still be challenging to navigate and analyze large amounts of log data.</p><p>One solution for easier log management could be to use an ELK (Elasticsearch, Logstash, Kibana) stack with Filebeat. That can be used to stream the content of the Logs folder on SFCC webdav to the ELK stack for analysis and visualization using Kibana. However, installing Filebeat on the server is not possible in this case.</p><p>The solution I found for this, is to use <a href="http://savannah.nongnu.org/projects/davfs2"><strong>davfs2</strong></a><strong> </strong>to mount our webdav resource as a regular file system on a docker container, that can be used easily by Filebeat.</p><p>In this article I will walk you through the use of this image.</p><p>You can find the code linked here : <a href="https://github.com/karimtaoudi/webDavClient">Repo</a></p><p>FileBeat image :</p><p><strong>Dockerfile :</strong></p><pre>ARG ELK_VERSION<br><br>FROM docker.elastic.co/beats/filebeat:${ELK_VERSION}<br><br>USER root<br><br>COPY ./config/filebeat.yml /usr/share/filebeat/filebeat.yml<br><br>ENV WEBDAV_URL=<br>ENV WEBDAV_USERNAME=<br>ENV WEBDAV_PASSWORD=<br>ENV WEBDAV_PASSWORD_FILE=<br><br>ENV OWNER=0<br><br>ENV WEBDAV_MOUNT=/usr/share/filebeat/logs<br><br>RUN yum upgrade -y &amp;&amp; \<br>    yum install -y curl epel-release<br><br>RUN yum install -y ca-certificates<br>RUN yum -y install davfs2 tini<br><br>COPY *.sh /usr/local/bin/<br><br>RUN chmod +x /usr/local/bin/docker-entrypoint.sh<br>RUN chmod +x /usr/local/bin/ls.sh<br><br>VOLUME [ &quot;/usr/share/filebeat/logs&quot; ]<br><br>ENTRYPOINT [&quot;tini&quot;, &quot;-g&quot;, &quot;--&quot;, &quot;/usr/local/bin/docker-entrypoint.sh&quot;]<br>CMD [ &quot;ls.sh&quot; ]</pre><ol><li>First we create an image from : docker.elastic.co/beats/filebeatt</li><li>provide filebeat config form our config folder : <em>COPY ./config/filebeat.yml /usr/share/filebeat/filebeat.yml</em></li></ol><p>PS : Once your container up you can test your configuration by running : filebeat test config.</p><p>3. We install all the necessary dependencies, especially davfs2 : <em>RUN yum -y install davfs2 tini</em></p><p>PS : Filebeat elastic image is a centos image, hence using yum as a paskage manager.</p><p>4. perform all system-level mounting as part of the entrypoint to then have a command that will keep listing the files. Listing the files will keep the share active and avoid that the remote server closes the connection.</p><p><em>ENTRYPOINT [“tini”, “-g”, “ — “, “/usr/local/bin/docker-entrypoint.sh”]</em></p><p><em>CMD [ “ls.sh” ]</em></p><p><strong>docker-entrypoint.sh :</strong></p><p>You can check the whole file under my github <a href="https://github.com/karimtaoudi/webDavClient">repo</a> , but the most important part is the mount on the wabdav ressource :</p><pre>mount -t davfs $WEBDAV_URL $DEST -o uid=$OWNER,gid=users,dir_mode=755,file_mode=755</pre><p>we basically use the <a href="http://savannah.nongnu.org/projects/davfs2">davfs2</a> to mount our remote webdav ressource ( SFCC logs ) on the destination folder within the container file system. This is provided as a parameter to the container.</p><p>Docker-compose :</p><p>This can be used in a docker compose for example, to have SFCC logs analysed, and visualised in kibana.</p><pre>version: &#39;3.9&#39;<br><br>services:<br>  elasticsearch:<br>    build:<br>      context: elasticsearch/<br>      args:<br>        ELK_VERSION: $ELK_VERSION<br>    container_name: elasticsearch<br>    volumes:<br>      - type: bind<br>        source: ./elasticsearch/config/elasticsearch.yml<br>        target: /usr/share/elasticsearch/config/elasticsearch.yml<br>        read_only: true<br>      - type: volume<br>        source: elasticsearch<br>        target: /usr/share/elasticsearch/data<br>    ports:<br>      - &quot;9200:9200&quot;<br>      - &quot;9300:9300&quot;<br>    environment:<br>      ES_JAVA_OPTS: &quot;-Xmx256m -Xms256m&quot;<br>      ELASTIC_PASSWORD: changeme<br>      discovery.type: single-node<br>      node.name: elasticsearch<br>    networks:<br>      - elk<br>  <br>  logstash:<br>    build:<br>      context: logstash/<br>      args:<br>        ELK_VERSION: $ELK_VERSION<br>    volumes:<br>      - type: bind<br>        source: ./logstash/config/logstash.yml<br>        target: /usr/share/logstash/config/logstash.yml<br>        read_only: true<br>      - type: bind<br>        source: ./logstash/pipeline<br>        target: /usr/share/logstash/pipeline<br>        read_only: true<br>    ports:<br>      - &quot;5044:5044&quot;<br>      - &quot;9600:9600&quot;<br>    environment:<br>      LS_JAVA_OPTS: &quot;-Xmx1024m -Xms1024m&quot;<br>    networks:<br>      - elk<br>    depends_on:<br>      - elasticsearch<br>  <br>  kibana:<br>    build:<br>      context: kibana/<br>      args:<br>        ELK_VERSION: $ELK_VERSION<br>    volumes:<br>      - type: bind<br>        source: ./kibana/config/kibana.yml<br>        target: /usr/share/kibana/config/kibana.yml<br>        read_only: true<br>    ports:<br>      - &quot;5601:5601&quot;<br>    networks:<br>      - elk<br>    depends_on:<br>      - elasticsearch<br>  webdav-filebeat:<br>    build:<br>      context: FileBeat/<br>      args:<br>        ELK_VERSION: $ELK_VERSION<br>    environment:<br>      WEBDAV_USERNAME: username<br>      WEBDAV_PASSWORD: psw<br>      WEBDAV_URL: https://&lt;your-instance&gt;.demandware.net/on/demandware.servlet/webdav/Sites/Logs/<br>      WEBDAV_MOUNT: /usr/share/filebeat/logs<br>      DAVFS2_ASK_AUTH: 0<br>      INSTANCE: dev<br>    devices:<br>      - /dev/fuse<br>    cap_add:<br>      - SYS_ADMIN<br>    networks:<br>      - elk<br>networks:<br>  elk:<br>    driver: bridge<br><br>volumes:<br>  elasticsearch:<br><br></pre><p>PS : The device, cap-add options and their values are to make sure that the container will be able to make available the WebDAV resource using FUSE.</p><p>Filebeat by default waits for files under /usr/share/filebeat/logs. This is not really meant to change but you can use WEBDAV_MOUNT to change it if needed.</p><p>To create this I re-used some code from this repo : <a href="https://github.com/efrecon/docker-webdav-client">https://github.com/efrecon/docker-webdav-client</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c465d472ea0d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>