Skip to content

Exporting Audit Logs as CSV from Bindaas running as a Docker container

Pradeeban Kathiravelu edited this page Dec 17, 2018 · 10 revisions

We can export the audit logs from Bindaas running in a Docker container in 2 different ways.

Option 1: Without having to stop/restart the running Bindaas container instance

This option works if you have access to another running Bindaas instance in the same server or another location.

First, find the container name of the bindaas instance:

$ docker ps

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

332e0e1ebb63 pradeeban/bindaas:3.3.4 "sh run.sh" 5 minutes ago Up 5 minutes 0.0.0.0:8080->8080/tcp, 0.0.0.0:9099->9099/tcp bindaas-public

Then, copy the h2 database to your host:

$ docker cp [CONTAINER ID]:/root/bindaas/bin/bindaas.h2.db bindaas.h2.db

For example,

$ docker cp 332e:/root/bindaas/bin/bindaas.h2.db bindaas.h2.db

The above command will copy the h2 database to your current directory.

Now move it to the bin directory of a fresh Bindaas installation in the host.

You may choose to perform this action on another computer. Otherwise, you will probably need to stop the Bindaas container instance to avoid port conflicts (unless you want to perform modifications to the Bindaas execution to start on different ports instead of 8080 and 9099).

Start the Bindaas instance in the host with the -console command, as below:

$ java -Djava.net.preferIPv4Stack=true -Dpid=BINDAAS_INSTANCE -Xmx1024m -jar org.eclipse.osgi_3.10.100.v20150529-1857.jar -console

From the Bindaas osgi console, enter the below command

bindaas:audit:dump

This will leave bindaas.log.csv in your bindaas/bin directory.

Option 2: If the running Bindaas container instance can be stopped and started again shortly.

This option works if a little down-time is tolerated for the Bindaas instance.

First, find the container name of the bindaas instance:

$ docker ps

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

332e0e1ebb63 pradeeban/bindaas:3.3.4 "sh run.sh" 5 minutes ago Up 5 minutes 0.0.0.0:8080->8080/tcp, 0.0.0.0:9099->9099/tcp bindaas-public

Then, log in to that Docker instance:

$ sudo docker exec -i -t 332e /bin/sh

Find and kill the Bindaas process ID inside the container.

$ ps

PID USER TIME COMMAND 1 bindaas 0:00 sh run.sh 8 bindaas 0:32 java -jar -Dpid=BINDAAS_INSTANCE org.eclipse.osgi_3.10.100.v20150529-1857.jar 93 bindaas 0:00 /bin/sh 101 bindaas 0:00 ps

/root/bindaas/bin $ kill 8

Now start Bindaas with the -console flag from inside the container instance:

$ java -jar -Dpid=BINDAAS_INSTANCE org.eclipse.osgi_3.10.100.v20150529-1857.jar -console

From the Bindaas osgi console, enter the below command

bindaas:audit:dump

This will leave bindaas.log.csv in the directory in the host that has been mapped as a volume for /root/bindaas/bin in the container instance.

Clone this wiki locally