How to add Splunk agent to Azure Function Docker image?

Milind Singh 1 Reputation point
2022-09-12T11:53:33.97+00:00

I am using Java function app with docker using base image from azure-functions-docker.

How can I customize the below dockerfile and add Splunk agent as suggested in instrument-java-application.html ?

ARG JAVA_VERSION=11  
# This image additionally contains function core tools – useful when using custom extensions  
#FROM mcr.microsoft.com/azure-functions/java:4.0-java$JAVA_VERSION-core-tools AS installer-env  
FROM mcr.microsoft.com/azure-functions/java:4.0-java$JAVA_VERSION-build AS installer-env  
  
COPY . /src/java-function-app  
RUN cd /src/java-function-app && \  
    mkdir -p /home/site/wwwroot && \  
    mvn clean package && \  
    cd ./target/azure-functions/ && \  
    cd $(ls -d */|head -n 1) && \  
    cp -a . /home/site/wwwroot  
  
# This image is ssh enabled  
FROM mcr.microsoft.com/azure-functions/java:4.0-java$JAVA_VERSION-appservice  
# This image isn't ssh enabled  
#FROM mcr.microsoft.com/azure-functions/java:4.0-java$JAVA_VERSION  
  
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \  
    AzureFunctionsJobHost__Logging__Console__IsEnabled=true  
  
COPY --from=installer-env ["/home/site/wwwroot", "/home/site/wwwroot"]  

Refer: functions-create-function-linux-custom-image

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,897 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. MughundhanRaveendran-MSFT 12,476 Reputation points
    2022-09-15T10:04:44.893+00:00

    @Milind Singh ,

    Please refer to this documentation: https://docs.splunk.com/Observability/gdi/docker/docker.html

    Same approach can be applied to Functions as well

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.