Skip to content

Commit

Permalink
Updated Docs with windows and tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
Fujio-Turner committed Dec 13, 2023
1 parent 1c3a620 commit b92a3fc
Show file tree
Hide file tree
Showing 12 changed files with 173 additions and 89 deletions.
11 changes: 0 additions & 11 deletions Pipfile

This file was deleted.

10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ You just need to:

#### Result
It will:
Output all the Sync Gateway's databases
Output a list of names of all device users.
Output a graph of all the synced that happen from the: Begin & Date you picked.
You can pick a specific user to drill down to.
you can pick a specific sync for a specific user.
- Output all the Sync Gateway's databases
- Output a list of names of all device users.
- Output a graph of all the synced that happen from the: Begin & DateTime you picked.
- You can pick a specific user to drill down to.
- pick a specific sync(s) for a specific user.


###### Click here to get started: [Docs - SG Log Reader Demo](https://fujio-turner.github.io/sg-log-reader-demo/)
Binary file removed build/sg-log-reader/PYZ-00.pyz
Binary file not shown.
8 changes: 7 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ I created this tool to be able to debug SG issue by getting a local copy of a SG

- SG = Sync Gateway
- CBL = Couchbase Lites
- CB = Couchbase
- CB = Couchbases

#### NEW

version 2.1.0
- Windows(.exe)
- Logging to File

#### Future - More
In the future this will do more features to better understand other things going on inside SG. If you are wanting a new feature or there is a bug click here to report it: [SG Log Reader Demo - Issues](https://github.com/Fujio-Turner/sg-log-reader-demo/issues)
Expand Down
7 changes: 4 additions & 3 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

* [Docs Home](/)
* [Step 1. - Requirements](requirements.md)
* [Step 2. - Install & Configure](install.md)
* [Step 2. - Download & Configure](install.md)
* [Step 3. - Processing the Log File](process.md)
* [Step 4. - Getting The Dashboard](dashboard.md)
* [The Dashboard: How to Search & Filter](using.md)
* [How to Search & Filter](using.md)
* [FAQ: General](faq.md)
* [FAQ: Sync Issues](sync-issues.md)
* [FAQ: Sync Issues](sync-issues.md)
* [Build From Source](build.md)
91 changes: 91 additions & 0 deletions docs/build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@

### Requirements:

- Python 3.6 or greater

## Download the SG-Log-Reader-demo

## STEP 1
From the github.com/fujio-turner/sg-log-reader-demo repo

Click here to [Back To: SG Log Reader Demo - Github Repo](https://github.com/fujio-turner/sg-log-reader-demo)
You can clone the repo or just download it as a zip file and unzip it too.
```console
git clone https://github.com/Fujio-Turner/sg-log-reader-demo.git
```
OR

Download the as a ZIP file

<img title="Download Github Code as a Zip" alt="Download Github Code as a Zip" src="https://helpdeskgeek.com/wp-content/pictures/2021/06/11CodeButtonDownloadZip.png">


## STEP 2
## Install

Python Virtual Environment:
[https://pypi.org/project/pipenv/](https://pypi.org/project/pipenv/)

or

Homebrew install

```console
# brew install pipenv
```
Now open up a terminal and `cd` to the folder that you downloaded the sg-log-reader-demo into.

Once you are in the above folder run this code to create a Python Virtual Environment

```console
pipenv shell
```

Install some Python libaries that will run in in your virtual environment.

```console
pipenv install couchbase
pipenv install flask
pipenv install icecream
```


[HOW TO: Configure JSON](/install)


## STEP 3

```console
python3 sg-log-reader.py config.json
```

The output should look like this below:


```console
Starting - Reading Data File: 2023-11-05 09:43:35.072700
Number - Lines in log file: 766836
Number - WebSocket Connections: 18585
Done - Reading Data File: 2023-11-05 09:43:37.112688
Starting - Per wsId : 2023-11-05 09:43:37.112698
Done - Per wsId : 2023-11-05 09:48:19.576021
```


## STEP 4
To get to the dashboard to see stats you will run a local Python Flask Web Server. Run the command below to start the web server.

```console
python3 app.py config.json
```

OUTPUT should look something like this.

```console
* Serving Flask app 'app'
* Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:8080
* Running on http://192.168.0.193:8080
```
23 changes: 12 additions & 11 deletions docs/dashboard.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@

### Getting the Dashboard

To get to the dashboard to see stats you will run a local Python Flask Web Server. Run the command below to start the web server.
To get to the dashboard run the below command.

```console
python3 app.py config.json
```
<!-- tabs:start -->

OUTPUT should look something like this.
#### **Windows**

```console
* Serving Flask app 'app'
* Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:8080
* Running on http://192.168.0.193:8080
app.exe config.json
```

#### **macOS**

Coming Soon

<!-- tabs:end -->



Now open up your web browser and go to: [http://127.0.0.1:8080](http://127.0.0.1:8080)


Expand Down
23 changes: 14 additions & 9 deletions docs/faq.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
### FAQ


+ What version of Python do I need ? +

Python 3.6+

+ Is there any configuration to the script ? +

Yes, there is a config.json file that you can update with things like credentials to a Couchbase bucket. Click Here for more details about the config.json file [Install & Config](/install)


+ Is what version of SG logs will it work on ? +

Its been testing with SG version 2.8.x to 3.0.1. Sorta works with 3.1.x


+ What is the `sg_info.log` ? +
Expand All @@ -24,7 +15,21 @@

The default location for the SG log files are `/home/sync_gateway/logs/` there you will find `sg_info.log` OR do a [_sgcollect_info](https://docs.couchbase.com/sync-gateway/current/rest-api-admin.html#/Server/post__sgcollect_info) locally on the running SG machine and it will create a zip with a bunch of SG logs and in it `sg_info.log` is also included.

+ Is there any configuration to the script ? +

Yes, there is a config.json file that you can update with things like credentials to a Couchbase bucket. Click Here for more details about the config.json file [Install & Config](/install)


+ Is what version of SG logs will it work on ? +

Its been testing with SG version 2.8.x to 3.0.1. Sorta works with 3.1.x

+ The sg-log-file scripts are not working why? +

Check the log file it creates. It's ussually because the script can not connect to the Couchbase Server. misspelled bucket name , wrong username & password .... etc. So double check the `config.json`

+ If I have 2 or more SGs behind a load balancer can I process them together and see the results in the dashboard ? +

Yes you can be they will have different Websocket IDs. In the `config.json` there is a field to seperate the source. `"log-name":"test-today-node-0", ///Optional: if you process multiple SG nodes you can tag the logs source here.` But there currently no way in the Dashboard to see which logs are from which SG node.


14 changes: 14 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
-->
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/themes/buble.css" />
<link rel="stylesheet" href="//unpkg.com/docsify-accordion/src/style.css">
<style>
:root {
--docsifytabs-border-color: #ededed;
--docsifytabs-tab-highlight-color: rgb(18, 4, 213);
}
</style>
</head>
<body>
<div id="app"></div>
Expand All @@ -23,6 +29,13 @@
buttonText: 'Copy to clipboard',
errorText: 'Error',
successText: 'Copied',
},
tabs: {
persist : true,
sync : true,
theme : 'classic',
tabComments: true,
tabHeadings: true
}
}
</script>
Expand All @@ -32,5 +45,6 @@
<script src="https://unpkg.com/docsify-copy-code@2"></script>
<script src="//unpkg.com/docsify-pagination/dist/docsify-pagination.min.js"></script>
<script src="//unpkg.com/docsify-accordion/src/index.js"></script>
<script src="https://cdn.jsdelivr.net/npm/docsify-tabs@1"></script>
</body>
</html>
46 changes: 12 additions & 34 deletions docs/install.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,26 @@
## Step 2. - Install & Configure

## Download the SG-Log-Reader-demo
### Download Executables

From the github.com/fujio-turner/sg-log-reader-demo repo
Click here to [SG Log Reader Demo - Github Repo: Releases](https://github.com/Fujio-Turner/sg-log-reader-demo/tree/master/releases)

Click here to [Back To: SG Log Reader Demo - Github Repo](https://github.com/fujio-turner/sg-log-reader-demo)
You can clone the repo or just download it as a zip file and unzip it too.
```console
git clone https://github.com/Fujio-Turner/sg-log-reader-demo.git
```
OR

Download the as a ZIP file
<!-- tabs:start -->

<img title="Download Github Code as a Zip" alt="Download Github Code as a Zip" src="https://helpdeskgeek.com/wp-content/pictures/2021/06/11CodeButtonDownloadZip.png">
#### **Windows**

In the main repo in the `releases\{version}` folder there are Windows(.exe).

## Install
Download all three files into your local folder.
- sg-log-reader.exe
- app.exe
- config.json

Python Virtual Environment:
[https://pypi.org/project/pipenv/](https://pypi.org/project/pipenv/)
#### **macOS**

or
Coming Soon

Homebrew install

```console
# brew install pipenv
```
Now open up a terminal and `cd` to the folder that you downloaded the sg-log-reader-demo into.

Once you are in the above folder run this code to create a Python Virtual Environment

```console
pipenv shell
```

Install some Python libaries that will run in in your virtual environment.

```console
pipenv install couchbase
pipenv install flask
pipenv install icecream
```
<!-- tabs:end -->


## Configure
Expand Down
27 changes: 14 additions & 13 deletions docs/process.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
## Step 3. - Processing the Log File

Let's parse the `sg_info.log` file. Run the command below in the directory of the sg-log-reader downloaded folder
Let's parse the `sg_info.log` file.

```console
python3 sg-log-reader.py config.json
```

The output should look like this below:
<!-- tabs:start -->

#### **Windows**

Open up a terminal and `cd` command into the directory of the sg-log-reader downloaded folder and run the file pointing to the config.json

```console
Starting - Reading Data File: 2023-11-05 09:43:35.072700
Number - Lines in log file: 766836
Number - WebSocket Connections: 18585
Done - Reading Data File: 2023-11-05 09:43:37.112688
Starting - Per wsId : 2023-11-05 09:43:37.112698
Done - Per wsId : 2023-11-05 09:48:19.576021
sg-log-reader.exe config.json
```
**NOTE:** `sg_info.log` file that is large , 100MB+ and/or more have a lot of unique WebSocket information will take a long time to process.

After you get the above `Done - Per wsId: ...` data should be in your Couchbase bucket.
#### **macOS**

Coming Soon

<!-- tabs:end -->


**NOTE:** `sg_info.log` file that is large , 100MB+ and/or more have a lot of unique WebSocket information will take a long time to process.

###### More Notes
I recently added Async to the script so you might get weird errors because it proccessing lots of websocket IDs at onec. It <i>Should</i> be ok :-|
2 changes: 0 additions & 2 deletions docs/requirements.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
## Step 1. - Requirements
### Requirements:

- Python 3.6 or greater

- Couchbase Cluster 7.x with Index & Query Services

- Couchbase Bucket (named: `sg-log-reader._default._default`)
Expand Down

0 comments on commit b92a3fc

Please sign in to comment.