[syslog-ng] Unbale to mount syslog-ng.conf to /etc/syslog-ng using docker image

Szemere, László laszlo.szemere at balabit.com
Fri May 25 14:57:11 UTC 2018


Hello,

 From the Docker documentation:
https://docs.docker.com/v17.09/engine/admin/volumes/bind-mounts/#differences-between--v-and---mount-behavior

If you use -v or --volume to bind-mount a file or directory that does not
> yet exist on the Docker host, -v will create the endpoint for you.
> *It is always created as a directory.*If you use --mount to bind-mount a
> file or directory that does not yet exist on the Docker host, Docker does
> *not* automatically create it for you, but generates an error.



 It looks like docker daemon still can not find your file
*"$PWD"/syslog-ng.conf* and creates a directory instead.
 Instead of heavy debugging, I suggest to run *docker inspect syslog-ng* to
see what path was actually mounted by the docker daemon. You should see
something like this in the output:

 "Mounts": [
>             {
>                 "Type": "bind",
>                 "Source": "XXX/syslog-ng.conf",
>                 "Destination": "/1234",
>                 "Mode": "",
>                 "RW": true,
>                 "Propagation": "rprivate"
>             }



 Once we have the actual mounted path, it will be easier to figure out why
the docker daemon can not find your original config file.

Br,
Laci



On Fri, May 25, 2018 at 4:19 PM, Mujeeb Baig <baig.mujeeb at gmail.com> wrote:

> Hi Andrew,
>
> Thanks for your response. Yes the path is correct
>
> When I execute with host location as /1234 it creates the container, but
> nothing inside /1234 folder
>
> root at hdata3:/home/smb/code/conf# docker run -it -v
> "$PWD"/syslog-ng.conf:/1234  --name syslog-ng   -p 514:514 -p 601:601
>  balabit/syslog-ng:latest
> syslog-ng: Error setting capabilities, capability management disabled;
> error='Operation not permitted'
> [2018-05-25T14:12:15.695588] WARNING: Configuration file format is too
> old, syslog-ng is running in compatibility mode. Please update it to use
> the syslog-ng 3.14 format at your time of convenience. To upgrade the
> configuration, please review the warnings about incompatible changes
> printed by syslog-ng, and once completed change the @version header at the
> top of the configuration file.;
>
>
>
>
> I can see inside the container that  /etc/syslog-ng/ this folder is not
> updated
>
> root at hdata3:/home/smb# docker exec -ti syslog-ng /bin/bash
> root at d634d32aee4c:/#
> root at d634d32aee4c:/# ls -l /1234/
> total 0
> root at d634d32aee4c:/#
> root at d634d32aee4c:/# ls -l /sy/etcslog-ng/
> conf.d/         patterndb.d/    scl.conf        syslog-ng.conf
> root at d634d32aee4c:/# ls -lrt /etc/syslog-ng/
> total 12
> -rw-r--r--. 1 root root 5910 Feb 23 13:17 syslog-ng.conf
> drwxr-xr-x. 2 root root    6 Mar  2 12:58 conf.d
> drwxr-xr-x. 2 root root    6 Mar  2 12:58 patterndb.d
> -rw-r--r--. 1 root root 1336 Mar  2 12:58 scl.conf
> root at d634d32aee4c:/#
>
>
>
> On 25 May 2018 at 13:31, Mitzki, András <andras.mitzki at balabit.com> wrote:
>
>> Hi Mujeeb,
>>
>> Maybe the problem is with the config file path:
>> "/home/smb/code/conf/syslog-ng.conf"
>> Could you check that path is correct?
>>
>> Regards
>> Andrew
>>
>> On Fri, May 25, 2018 at 1:13 PM, Mujeeb Baig <baig.mujeeb at gmail.com>
>> wrote:
>>
>>> Hi
>>>
>>> This is my first trial of syslog-ng. I've tried to start syslog-ng just
>>> like described on the official bolg page https://syslog-ng.com/blog/cen
>>> tral-log-server-docker/ https://syslog-ng.com/blog/col
>>> lecting-docker-infrastructure-logs-using-syslog-ng/
>>>
>>> I am starting docker container as:
>>>
>>> docker run -it -v "$PWD"/syslog-ng.conf:/etc/syslog-ng/syslog-ng.conf
>>> --name syslog-ng -p 514:514 -p 601:601 balabit/syslog-ng:latest
>>>
>>> But unfortunately it is failing to mount my custom (local) configuration
>>> file from source to host, complaining about mounting a directory onto file
>>>
>>> Error:
>>>
>>> docker: Error response from daemon: OCI runtime create failed:
>>> container_linux.go:348: starting container process caused
>>> "process_linux.go:402: container init caused \"rootfs_linux.go:58: mounting
>>> \\"/home/smb/code/conf/syslog-ng.conf\\" to rootfs
>>> \\"/var/lib/docker/devicemapper/mnt/52d32f854a030b396b03e759
>>> 6ab5d71eb1a18f34a09d5e4997c437568749b259/rootfs\\" at
>>> \\"/var/lib/docker/devicemapper/mnt/52d32f854a030b396b03e759
>>> 6ab5d71eb1a18f34a09d5e4997c437568749b259/rootfs/etc/syslog-ng/syslog-ng.conf\\"
>>> caused \\"not a directory\\"\"": unknown: Are you trying to mount a
>>> directory onto a file (or vice-versa)? Check if the specified host path
>>> exists and is the expected type.
>>>
>>> Am I missing something?
>>>
>>> Please let me know
>>>
>>> Many Thanks
>>>
>>> Mujeeb
>>>
>>>
>>>
>>> ____________________________________________________________
>>> __________________
>>> Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng
>>> Documentation: http://www.balabit.com/support
>>> /documentation/?product=syslog-ng
>>> FAQ: http://www.balabit.com/wiki/syslog-ng-faq
>>>
>>>
>>>
>>
>> ____________________________________________________________
>> __________________
>> Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng
>> Documentation: http://www.balabit.com/support/documentation/?product=
>> syslog-ng
>> FAQ: http://www.balabit.com/wiki/syslog-ng-faq
>>
>>
>>
>
> ____________________________________________________________
> __________________
> Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng
> Documentation: http://www.balabit.com/support/documentation/?
> product=syslog-ng
> FAQ: http://www.balabit.com/wiki/syslog-ng-faq
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.balabit.hu/pipermail/syslog-ng/attachments/20180525/f69c7889/attachment-0001.html>


More information about the syslog-ng mailing list