Skip to content

Commit

Permalink
Initial Tableau Log Viewer 1.0 release! (dev>master, #24)
Browse files Browse the repository at this point in the history
  • Loading branch information
whenamanlies authored Oct 29, 2016
1 parent 2c483c4 commit a0563f9
Show file tree
Hide file tree
Showing 34 changed files with 740 additions and 323 deletions.
114 changes: 114 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Building Tableau Log Viewer

TLV is built using C++ and Qt libraries and can be build in different platforms.

You can get the Qt libraries from the [Qt Site](https://www.qt.io/download/). It is fine to use the Open Source version.

**Note:** When installing Qt make sure you get the following components: `Qt WebView` and `Qt WebEngine`.

## Building on Mac (using command line)
The following instructions use Qt 5.7 and the clang compiler to compile a 64-bit binary.
Building TLV with a different Qt version or compiler should be fairly similar.

```bash
# Start by cloning the repository
git clone https://github.com/tableau/tableau-log-viewer.git
cd tableau-log-viewer

# Find out where the Qt libraries are stored in your disk drive, and add the directory to the PATH
export PATH="~/Qt/5.7/clang_64/bin":$PATH

# Create a directory to compile
mkdir build-release && cd build-release

# Build
qmake -spec macx-clang CONFIG+=x86_64 -Wall ../src/tableau-log-viewer.pro
make

# Make a self-contained app
macdeployqt tlv.app

# Run the application
open tlv.app
```


## Building on Windows (using command line)
The following instructions use Qt 5.6 and the Visual Studio 2013 compiler (mscv2013) to compile a 64-bit binary.
Building TLV with a different Qt version or compiler should be fairly similar.

The following instructions use two command line windows:
* The **Git Bash** terminal that you get from a standard Git installation on Windows. Search for "Git Bash" in the start menu.
* The **Visual Studio Tools Command Prompt** that you get from a Visual Studio installation.
There's a link from the Start Menu -> Visual Studio 2013 -> Visual Studio Tools.
It is called "VS2013 x64 Native Tools Command Prompt".

**From Git Bash:**
```bash
# Start by cloning the repository
git clone https://github.com/tableau/tableau-log-viewer.git
cd tableau-log-viewer

# Find out where the Qt libraries are stored in your disk drive, and add the directory to the PATH
export PATH=$PATH:"/c/Qt/5.6/msvc2013_64/bin"

# Make build directory and run QMake
mkdir build-release
cd build-release
qmake -spec win32-msvc2013 CONFIG+=x86_64 -Wall ../src/tableau-log-viewer.pro
```
To compile, the enviroment has to be set up to use the correct tools. The easiest way is to use the Visual Studio prompt.

**From the Visual Studio command prompt:**
```cmd
cd \path\to\tableau-log-viewer\build-release
nmake
```
The binary will appear under build-release/release.
The executable needs the Qt libraries to run. The Git Bash command prompt already had the Qt libraries on the PATH.

**Back to the Git Bash:**
```bash
# Run the executable
cd release
./tlv.exe
```

## Buiding using Qt Creator
Start by cloning the repository
```bash
git clone https://github.com/tableau/tableau-log-viewer.git
```

1. Launch Qt Creator and open the project file, it should be under *src/tableau-log-viewer.pro*
2. Configure the new project. The default configuration might be good enough, if you have problems see the section "Fixing configuration"
3. Click on the Build button (the one with the Hammer)
4. Click on the Run button

If everything went well, TLV should be up and running!

### Fixing configuration
The project can be configured with different compiler and targets.

To change the configuration:

1. Click on the Projects button (the one with a wrench)
2. On the "Build & Run" section, click on "Manage kits..."

We have only tried a handful of configurations. Here are some that are known to work (strings as displayed by Qt creator)

#### Windows, Visual Studio 2013 compiler, 64 bit
* Compiler: Microsoft Visual C++ Compiler 12.0 (amd64)
* Qt Version: Qt 5.X.X MSVC2013 64bit
* [Optional but recommended] Add a 64 bit debugger
1. Switch to the "Debuggers" tab.
2. Click on the "Add" button
3. Give a name you can recognize later like "CDB 64 bit"
4. Find the 64 bit binary. It should be under `C:\debuggers\x64\cdb.exe` or similar
5. Save the changes clicking the "Apply" button
6. Go back to the "Kits" tab and choose the debugger configuration just created

#### Mac OS X, clang compiler, 64 bit
* Compiler: Clang (x86 64 bit in /usr/bin)
* Debugger: System LLDB at /usr/bin/lldb
* Qt Version: Qt 5.X.X clang 64bit
30 changes: 22 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,35 @@

Tableau Log Viewer is cross-platform tool with a simple interface that has a single purpose of making it easy to quickly glance over Tableau log files.

Features
![TLV Screenshot](https://cloud.githubusercontent.com/assets/1087437/19377630/b1ca0d56-919c-11e6-9c01-200697c37194.png "TLV running on Windows 10")

Overview
---------------
* Tableau log file representation in easy to read columnar format
* Advanced event search and highlighting
* Live capture from Tableau's log files
* Advanced event search, filtering and highlighting
* Query syntax highlighting
* Live capture: events appear as they happen
* Supported on Windows and Mac (and can be built on Linux)
* Compatible with Windows, Mac and, most likely, Linux

How do I use Tableau Log Viewer?
---------------
Simply launch the application and drag'n'drop Tableau's log file. Both Tableau Desktop and [most] Tableau Server log files are supported.
Take a look at our [wiki](https://github.com/tableau/tableau-log-viewer/wiki) to get more details on the features and usage of TLV.

How do I get started with Tableau Log Viewer?
Simply launch the application and drag'n'drop Tableau's log file. Both Tableau Desktop and [most] Tableau Server log files are supported. More detailed information can be found on [wiki](https://github.com/tableau/tableau-log-viewer/wiki)
How do I build Tableau Log Viewer?
---------------
See [INSTALL.md](INSTALL.md)

Is Tableau Log Viewer supported?
---------------
Tableau Log Viewer is made available AS-IS with no support. This is intended to be a self service tool and includes a user guide. Any requests or issues discovered should be filed in the [Issue Tracker](https://github.com/tableau/tableau-log-viewer/issues)
Tableau Log Viewer is made available AS-IS with no support. This is intended to be a self service tool and includes a user guide. Any requests or issues discovered should be filed in the [Issue Tracker](https://github.com/tableau/tableau-log-viewer/issues).

How can I contribute to Tableau Log Viewer?
---------------
Code contributions & improvements by the community are welcomed & encouraged! See the [LICENSE](https://github.com/tableau/TableauLogViewer/blob/master/LICENSE) file for current open-source licensing & use information.
Code contributions & improvements by the community are welcomed & encouraged! See the [LICENSE](LICENSE) file for current open-source licensing and use information. Also, if you are new to GitHub - read [this handy guide](https://guides.github.com/activities/contributing-to-open-source/) on how to get started!

A Word About Licenses
---------------
Tableau Log Viewer is released under MIT license however it relies on several other components:
* [Qt](https://www.qt.io/). We are using Qt's components that are licensed under [LGPLv3 license](https://www.qt.io/licensing-comparison/). Qt source code is located [here](http://code.qt.io/cgit/qt/qtbase.git/tree/) and instructions for obtaining it are located [here](https://wiki.qt.io/Building_Qt_5_from_Git#Getting_the_source_code). We will be keeping these links up to date and making sure they provide clear directions for obtaining Qt's source code in case you need it.
* [Query Graphs](https://github.com/tableau/tableau-log-viewer/tree/dev/resources/query-graphs). This is our side project that is used for query tree visualization. It is released under the MIT license and uses the d3js library, released under the BSD license.
9 changes: 9 additions & 0 deletions resources/default_filters/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Saved Filters

Share your filters with other users and give better default options to new users. The json files in the filters folder will be copied into the saved filter location and accessed from the Load Filters menu.

### How To Install Filters
On Windows, run the `install_all.bat` batch script. On Mac, run the `install_all.sh` script.

### Submit your own filter
To submit a filter of your own, find the filter in the ` %LOCALAPPDATA%\Tableau\TLV\filters\` folder on windows and `~/Library/Preferences/Tableau/TLV/filters` on Mac. Copy that filter json file into the `./default_filters/filters` folder and submit a pull request to github.
28 changes: 28 additions & 0 deletions resources/default_filters/filters/WebDataConnector.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[
{
"backgroundColor": [
191,
228,
243
],
"keys": [
"Key"
],
"matchCase": false,
"useRegex": false,
"value": "web-data-connector"
},
{
"backgroundColor": [
242,
236,
153
],
"keys": [
"Value"
],
"matchCase": false,
"useRegex": true,
"value": "^(http.*)"
}
]
5 changes: 5 additions & 0 deletions resources/default_filters/install_all.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@echo off
for /r %%i in (filters\*.json) do (
SET _dest=%LOCALAPPDATA%\Tableau\TLV\filters\
xcopy /i /e %%i %_dest%
)
17 changes: 17 additions & 0 deletions resources/default_filters/install_all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# find the location the filters live
BASEDIR=$(dirname "$0")
FILES=/filters/*
FILTERS=$BASEDIR$FILES

# make the filters directory if it doesn't exist
DEST=~/Library/Preferences/Tableau/TLV/filters/
mkdir -p $DEST

# go through and copy all the filters
for f in $FILTERS
do
cp "$f" "$DEST"
echo "$f"
done
Binary file added resources/images/ctx-open-file.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/images/value-next.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/images/value-previous.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 13 additions & 13 deletions resources/query-graphs/query-graphs.min.js

Large diffs are not rendered by default.

64 changes: 50 additions & 14 deletions src/colorlibrary.cpp
Original file line number Diff line number Diff line change
@@ -1,24 +1,60 @@
#include "colorlibrary.h"

const static QVector<QColor> DefaultColors =
{
QColor("#f2ec99"),
QColor("#bfe4f3"),
QColor("#bfe968"),
QColor("#c6caf8"),
QColor("#eec757"),
QColor("#9994f1"),
QColor("#edb0e8"),
QColor("#cebff3"),
QColor("#a5f0c6"),
QColor("#f5b0b4")
};

ColorLibrary::ColorLibrary()
{
m_colorLibrary = new QQueue<QColor>();
m_colorLibrary->enqueue(QColor("#f2ec99"));
m_colorLibrary->enqueue(QColor("#bfe4f3"));
m_colorLibrary->enqueue(QColor("#bfe968"));
m_colorLibrary->enqueue(QColor("#c6caf8"));
m_colorLibrary->enqueue(QColor("#eec757"));
m_colorLibrary->enqueue(QColor("#9994f1"));
m_colorLibrary->enqueue(QColor("#edb0e8"));
m_colorLibrary->enqueue(QColor("#cebff3"));
m_colorLibrary->enqueue(QColor("#a5f0c6"));
m_colorLibrary->enqueue(QColor("#f5b0b4"));
AddColors(DefaultColors);
}

ColorLibrary::ColorLibrary(const QVector<QColor>& usedColors)
{
Exclude(usedColors);
}

void ColorLibrary::Exclude(const QVector<QColor>& usedColors)
{
m_colorLibrary.clear();

QVector<QColor> colorsToAdd;
QVector<QColor> colorsToAddToEnd;
for(const auto& color : DefaultColors)
{
if (!usedColors.contains(color))
colorsToAdd.push_back(color);
else
colorsToAddToEnd.push_back(color);
}
AddColors(colorsToAdd);
AddColors(colorsToAddToEnd);
}

void ColorLibrary::AddColors(const QVector<QColor>& colors)
{
for (const auto& color : colors)
{
m_colorLibrary.enqueue(color);
}
}

QColor ColorLibrary::GetNextColor()
{
QColor result = m_colorLibrary->head();
auto color = m_colorLibrary->dequeue();
m_colorLibrary->enqueue(color);
QColor result = m_colorLibrary.head();
auto color = m_colorLibrary.dequeue();
m_colorLibrary.enqueue(color);
return result;
}


11 changes: 9 additions & 2 deletions src/colorlibrary.h
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
#ifndef COLORLIBRARY_H
#define COLORLIBRARY_H

#include <QVector>
#include <QColor>
#include <QQueue>

// The purpose of this class is to provide some default colors for highlight filters.
// Default colors are stored in a queue and once a color is used, it is enqueued again.
// If a color is being used from a loaded filter, it will be moved to the end of the queue.
class ColorLibrary
{
public:
ColorLibrary();
ColorLibrary(const QVector<QColor>& usedColors);

void Exclude(const QVector<QColor>& usedColors);
QColor GetNextColor();
void AddColor(QColor color);

private:
QQueue<QColor> * m_colorLibrary;
QQueue<QColor> m_colorLibrary;
void AddColors(const QVector<QColor>& colors);
};
#endif // COLORLIBRARY_H
6 changes: 3 additions & 3 deletions src/highlightdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
#include <QLineEdit>
#include <QMap>

HighlightDlg::HighlightDlg(QWidget *parent, HighlightOptions highlightOpts, ColorLibrary * colorLibrary) :
HighlightDlg::HighlightDlg(QWidget *parent, HighlightOptions highlightOpts, const ColorLibrary& colorLibrary) :
QDialog(parent),
m_colorLibrary(colorLibrary),
ui(new Ui::HighlightDlg)
{
ui->setupUi(this);
Expand All @@ -22,7 +23,6 @@ HighlightDlg::HighlightDlg(QWidget *parent, HighlightOptions highlightOpts, Colo
// Remove close button of the Help tab.
ui->tabWidget->tabBar()->tabButton(0, QTabBar::RightSide)->resize(0, 0);

m_colors = colorLibrary;
connect(this, &QDialog::accepted, this, &HighlightDlg::accepted);
BuildTabs(highlightOpts);
}
Expand Down Expand Up @@ -74,7 +74,7 @@ void HighlightDlg::AddNewTab()
auto newFilter = new FilterTab(nullptr, m_filterTabValueLabel);
ui->tabWidget->addTab(newFilter, " ");
ui->tabWidget->setCurrentIndex(ui->tabWidget->indexOf(newFilter));
newFilter->SetBackgroundColor(m_colors->GetNextColor());
newFilter->SetBackgroundColor(m_colorLibrary.GetNextColor());

connect(newFilter, &FilterTab::filterValueChanged, this, &HighlightDlg::TextChanged);
}
Expand Down
4 changes: 2 additions & 2 deletions src/highlightdlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ class HighlightDlg : public QDialog
Q_OBJECT

public:
HighlightDlg(QWidget *parent, HighlightOptions highlightOpts, ColorLibrary * colorLibrary);
HighlightDlg(QWidget *parent, HighlightOptions highlightOpts, const ColorLibrary& colorLibrary);
~HighlightDlg();
void keyPressEvent(QKeyEvent * k);

HighlightOptions m_highlightOpts;
ColorLibrary m_colorLibrary;

private slots:
void on_tabWidget_tabCloseRequested(int index);
Expand All @@ -38,7 +39,6 @@ private slots:
void accepted();

Ui::HighlightDlg *ui;
ColorLibrary * m_colors;
const QString m_filterTabValueLabel = "Highlight &log event values that contains substring:";
const int m_tabLabelSize = 20;
};
Expand Down
10 changes: 9 additions & 1 deletion src/highlightoptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,18 @@ QJsonArray HighlightOptions::ToJson()
void HighlightOptions::FromJson(const QJsonArray& json)
{
clear();
for (auto filterJson : json)
for (const auto& filterJson : json)
{
SearchOpt highlightFilter;
highlightFilter.FromJson(filterJson.toObject());
this->append(highlightFilter);
}
}

QVector<QColor> HighlightOptions::GetColors()
{
QVector<QColor> result;
for (const auto &searchOpt : *this)
result.push_back(searchOpt.m_backgroundColor);
return result;
}
Loading

0 comments on commit a0563f9

Please sign in to comment.