Tuesday 31 July 2018

IBM AppConnect Enterprise 11 - Fiddling with Containers and Logs

Some rough notes from today's tinkering …. in the context of throwing logs from ACE in a container to the outside world.

Next is to add ELK ( Elasticsearch / Logstash / Kibana ) into the mix …...

Create a directory to which to map the logs

mkdir ~/acelogs

Start the container

docker run --name myAce -e LICENSE=accept -v ~/acelogs:/home/aceuser/ace-server/log -p 7600:7600 -p 7800:7800 ibmcom/ace:11.0.0.0

Monitor the logs

tail -f ~/acelogs/integration_server.ace-server.events.txt

-or-

docker logs myAce -f

Monitor SysLog inside the container

docker exec -i -t myAce tail -f /var/log/syslog

- Note that there's nothing going on here, because ACE doesn't appear to be using syslog - this is next on my list ….

Inspect the container

docker inspect myAce

[
    {
        "Id": "85662e2ff8ed14579d883b42ef4c73a379dc2bb6387e66813a3ab8a29fe0980d",
        "Created": "2018-07-30T16:17:16.385528759Z",
        "Path": "/bin/bash",
        "Args": [
            "-c",
            "/usr/local/bin/ace_license_check.sh && IntegrationServer -w /home/aceuser/ace-server --console-log"
        ],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 5498,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2018-07-31T07:00:46.924337421Z",
            "FinishedAt": "2018-07-30T16:22:31.724425914Z"
        },
        "Image": "sha256:e2b6a1ec30896826a42c5c5effb4eee8e2ed25e694c41de73a2f3ba866e0717a",
        "ResolvConfPath": "/var/lib/docker/containers/85662e2ff8ed14579d883b42ef4c73a379dc2bb6387e66813a3ab8a29fe0980d/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/85662e2ff8ed14579d883b42ef4c73a379dc2bb6387e66813a3ab8a29fe0980d/hostname",
        "HostsPath": "/var/lib/docker/containers/85662e2ff8ed14579d883b42ef4c73a379dc2bb6387e66813a3ab8a29fe0980d/hosts",
        "LogPath": "/var/lib/docker/containers/85662e2ff8ed14579d883b42ef4c73a379dc2bb6387e66813a3ab8a29fe0980d/85662e2ff8ed14579d883b42ef4c73a379dc2bb6387e66813a3ab8a29fe0980d-json.log",
        "Name": "/myAce",
        "RestartCount": 0,
        "Driver": "aufs",
        "Platform": "linux",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": [
                "/Users/davidhay/acelogs:/home/aceuser/ace-server/log"
            ],
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "default",
            "PortBindings": {
                "7600/tcp": [
                    {
                        "HostIp": "",
                        "HostPort": "7600"
                    }
                ],
                "7800/tcp": [
                    {
                        "HostIp": "",
                        "HostPort": "7800"
                    }
                ]
            },
            "RestartPolicy": {
                "Name": "no",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "CapAdd": null,
            "CapDrop": null,
            "Dns": [],
            "DnsOptions": [],
            "DnsSearch": [],
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "shareable",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": null,
            "UTSMode": "",
            "UsernsMode": "",
            "ShmSize": 67108864,
            "Runtime": "runc",
            "ConsoleSize": [
                0,
                0
            ],
            "Isolation": "",
            "CpuShares": 0,
            "Memory": 0,
            "NanoCpus": 0,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": [],
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": [],
            "DeviceCgroupRules": null,
            "DiskQuota": 0,
            "KernelMemory": 0,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": null,
            "OomKillDisable": false,
            "PidsLimit": 0,
            "Ulimits": null,
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0,
            "MaskedPaths": [
                "/proc/acpi",
                "/proc/kcore",
                "/proc/keys",
                "/proc/latency_stats",
                "/proc/timer_list",
                "/proc/timer_stats",
                "/proc/sched_debug",
                "/proc/scsi",
                "/sys/firmware"
            ],
            "ReadonlyPaths": [
                "/proc/asound",
                "/proc/bus",
                "/proc/fs",
                "/proc/irq",
                "/proc/sys",
                "/proc/sysrq-trigger"
            ]
        },
        "GraphDriver": {
            "Data": null,
            "Name": "aufs"
        },
        "Mounts": [
            {
                "Type": "bind",
                "Source": "/Users/davidhay/acelogs",
                "Destination": "/home/aceuser/ace-server/log",
                "Mode": "",
                "RW": true,
                "Propagation": "rprivate"
            }
        ],
        "Config": {
            "Hostname": "85662e2ff8ed",
            "Domainname": "",
            "User": "aceuser",
            "AttachStdin": false,
            "AttachStdout": true,
            "AttachStderr": true,
            "ExposedPorts": {
                "7600/tcp": {},
                "7800/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "LICENSE=accept",
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "BASH_ENV=/usr/local/bin/ace_env.sh"
            ],
            "Cmd": [
                "/bin/bash",
                "-c",
                "/usr/local/bin/ace_license_check.sh && IntegrationServer -w /home/aceuser/ace-server --console-log"
            ],
            "ArgsEscaped": true,
            "Image": "ibmcom/ace:11.0.0.0",
            "Volumes": null,
            "WorkingDir": "/home/aceuser",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": {
                "maintainer": "Dan Robinson <dan.robinson@uk.ibm.com>",
                "product.id": "447aefb5fd1342d5b893f3934dfded73",
                "product.name": "IBM App Connect Enterprise",
                "product.version": "11.0.0.0"
            }
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "995cc719e422a83639ac1b56c5b058d416805086854b753cf3735906c676c329",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {
                "7600/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "7600"
                    }
                ],
                "7800/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "7800"
                    }
                ]
            },
            "SandboxKey": "/var/run/docker/netns/995cc719e422",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "a64b6f54d6bd4808f0a68e89991f88dd13b7a82fb588067ad14ebbe067b49ab0",
            "Gateway": "172.17.0.1",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "172.17.0.3",
            "IPPrefixLen": 16,
            "IPv6Gateway": "",
            "MacAddress": "02:42:ac:11:00:03",
            "Networks": {
                "bridge": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "NetworkID": "0a85739e0f5285e6e3a0c006ec0e1547b18a13fe368865c0dc613c2ea933b2a7",
                    "EndpointID": "a64b6f54d6bd4808f0a68e89991f88dd13b7a82fb588067ad14ebbe067b49ab0",
                    "Gateway": "172.17.0.1",
                    "IPAddress": "172.17.0.3",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:ac:11:00:03",
                    "DriverOpts": null
                }
            }
        }
    }
]

Check Docker logging driver

docker info | grep 'Logging Driver'

Logging Driver: json-file

Check Logging Driver for container

docker inspect -f '{{.HostConfig.LogConfig.Type}}' myAce

json-file

Stop the container, when required

docker stop myAce

Start the container

docker start myAce

Start a shell session

docker exec -i -t myAce /bin/bash

No comments:

Visual Studio Code - Wow 🙀

Why did I not know that I can merely hit [cmd] [p]  to bring up a search box allowing me to search my project e.g. a repo cloned from GitHub...