How to use docker logging plugin

  docker, splunk

I have a Docker container(.net core application) running in OpenShift. We would like to have our logs pushed to SPLUNK Enterprise which is already there.

We have come across below plugin
https://github.com/splunk/docker-logging-plugin

My Current Dokerfile builds and contains steps to run my .net applications. Where should I specify the configuration for "docker-logging-plugin" ?

# ----------- Base
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
.....
Initial Docker base steps....

//How to have splunk configured here ?

# ----------- Final
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Employee.WebServices.dll"]

Should the Docker-logging-plugin configuration be included in my current Dockerfile which contains steps to build and run my .net core app or should it be like a separate container.

If its a saparate container how does it know it has to read logs from my container and push to SPLUNK ?

docker run 
    --log-driver=splunk 
    --log-opt splunk-token=176FCEBF-4CF5-4EDF-91BC-703796522D20 
    --log-opt splunk-url=https://splunkhost:8088 
    --log-opt splunk-capath=/path/to/cert/cacert.pem 
    --log-opt splunk-caname=SplunkServerDefaultCert 
    --log-opt tag="{{.Name}}/{{.FullID}}" 
    --log-opt labels=location 
    --log-opt env=TEST 
    --env "TEST=false" 
    --label location=west 
    your/application   //What should I mention here ?

In the above command what should I specify for "your/application"

Source: Docker Questions

LEAVE A COMMENT