Quick Start Enterprise via Docker
SwiftyBeaver Enterprise is running on your infrastructure and is collecting, decrypting, authenticating, organizing and finally storing your end-to-end encrypted client devices’ logs securely on your Elasticsearch cluster. The logs can be browsed and queried using the Kibana Web UI which is also running on your own infrastructure.
The combination of the SwiftyBeaver Logging Framework, SwiftyBeaver Enterprise, Elasticsearch & Kibana is a uniquely secure, compliant and scalable logging solution for native apps.
Quick Local Setup
For quick trial or development purpose it is sometimes helpful to have a local Elasticsearch, Kibana & SwiftyBeaver Enterprise setup on a Mac or Linux computer. The only requirement is Docker itself which can be installed via the Docker macOS App.
The following instructions will create 3 containers:
- Elasticsearch running on
localhost:9200with Basic Auth credentials
- Kibana running on
localhost:5601which is connected to Elasticsearch
- SwiftyBeaver Enterprise running on
localhost:8080with the app credentials
secret1and encryption key
The setup is not meant for production! Please consult the official Elasticsearch documentation for how to run Elasticsearch and Kibana on production.
1. Build & Run Elasticsearch & Kibana
Follow the instructions how to setup Elasticsearch & Kibana locally via Docker and proceed with step 2.
Or install everything even faster:
You can also use the Docker Compose instructions instead which install Elasticsearch, Kibana & SwiftyBeaver Enterprise faster and easier via Docker Compose. If you follow the Docker Compose instructions then you can skip the next steps 2, 3 and 4 and directly continue with step "5. Create Dummy Log Entries" using your already running cluster.
2. Download & Build SwiftyBeaver Enterprise Image
# download & build SwiftyBeaver Enterprise cd /tmp curl -L https://lodge.swiftybeaver.com/dl/Dockerfile -o Dockerfile docker rmi sbenterprise docker build -t sbenterprise .
3. Run SwiftyBeaver Enterprise Container
A SwiftyBeaver Enterprise container in non-daemonized mode is created. That makes it easier to read the start messages of SwiftyBeaver Enterprise to spot any issues. The container is deleted on stop via the parameter
--rm. Press CTRL+C to stop the container.
You can set the required environment variables directly with the container creation call:
# run SwiftyBeaver Enterprise, stop with CTRL+C docker run --rm -ti -p 8080:8080 --link elastic:elastic-url \ -e APPS='app1|secret1|NdpZuVMN6cVC3e7MGaVxRKzCJttoY3tL' \ -e LICENSE='' \ -e ES_HOST='http://elastic-url:9200' \ -e ES_AUTH_USER='elastic' \ -e ES_AUTH_PASSWORD='secret' \ --name sbenterprise sbenterprise
SwiftyBeaver Enterprise is now running on http://localhost:8080
4. Test SwiftyBeaver Enterprise Connection
Open a new Terminal window and try to connect to the running SwiftyBeaver Enterprise container to see if it works properly:
# Unprotected ping connection to see if server is running curl "http://localhost:8080/ping" > pong # Basic Auth protected call to the server using app credentials curl "http://localhost:8080/api/status" -u 'app1:secret1' > SwiftyBeaver Enterprise > Version: 2.0.0 > Build: 28 > License: UNLICENSED TRIAL > Every 2nd incoming log message is replaced with an upgrade text during your trial! > Please contact email@example.com to get your license key. > App IDs: app1 > Elasticsearch: connected
5. Create Dummy Log Entries
You could now add the above mentioned app credentials to your SBPlatformDestination() of the SwiftyBeaver Logging Framework inside your native app and start logging as described here. But instead we do an even quicker way of testing the storing of logs by letting SwiftyBeaver Enterprise generate some test logs by itself which are then stored in Elasticsearch:
curl "http://localhost:8080/api/dummy_entries" -u 'app1:secret1' > Created 2 dummy log entries
6. Browse Logs in Kibana
Now let’s log into Kibana and see if we find the created logs which SwiftyBeaver Enterprise stored in Elasticsearch.
1. Open in your browser the Kibana URL http://localhost:5601 and log in with username "elastic" and password "secret".
2. On the next page enter "sbenterprise-*" in the field Index Pattern and after some seconds select "DateTime" as Time Filter:
3. After clicking on "Create" please select in the left sidebar the "Discover" menu item close to the top. This will show the created logs sorted by creation time descending:
4. Now click in the "Available Fields" list in the gray center area on the items "LevelName", "Message" and "UserName". The list of logs will be now reduced to just show these fields as columns.
After some further testing and especially when you send real logs from your devices to SwiftyBeaver Enterprise you will see that every second log message is " UNLICENSED TRIAL" which is part of the trial limitations. These messages will stay until you purchased and used a valid SwiftyBeaver Enterprise:
5. Let's query our logs and search all logs which have the "info" LevelName and the log message contains the word "dummy". In Kibana that can be done by entering the following search query into the search field: " LevelName: info AND Message: dummy"
7. Next Steps
You have now a working and connected local Elasticsearch, Kibana & SwiftyBeaver Enterprise stack as proof of concept.
As next step you can setup a production system in the cloud or on your own infrastructure, including load balancer, high availability and high scalability and let your native apps securely send logs to it. You can browse these logs in Kibana in the same way as you did in a secure and scalable way.
And finally unlock your SwiftyBeaver Enterprise installation by ordering a license key.