Skip to content

Commit

Permalink
[docs] : rephrase + added example to query logging section (#7032)
Browse files Browse the repository at this point in the history
* rephrase + added expample to query logging

* rephrase + typos
  • Loading branch information
OmarAyo authored Dec 3, 2020
1 parent cadf448 commit bc41f51
Showing 1 changed file with 30 additions and 3 deletions.
33 changes: 30 additions & 3 deletions wiki/content/deploy/log-format.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ weight = 9

Dgraph's log format comes from the glog library and is [formatted](https://github.com/golang/glog/blob/23def4e6c14b4da8ac2ed8007337bc5eb5007998/glog.go#L523-L533) as follows:

`Lmmdd hh:mm:ss.uuuuuu threadid file:line] msg...`
```
Lmmdd hh:mm:ss.uuuuuu threadid file:line] msg...
```

Where the fields are defined as follows:

Expand All @@ -23,6 +25,31 @@ Where the fields are defined as follows:
msg The user-supplied message
```

## Query Logging
## Increase Logging

To increase logging, you have set `-v=3` which will enable verbose logging for everything. You can set this flag on both Zero and Alpha nodes.

Alternatively, you can set `--vmodule=server=3` for only the Alpha node which would only enable query/mutation logging.

{{% notice "note" %}}
This requires a restart of the node itself.

Avoid keeping logging verbose for a long time. Revert back to default setting if not needed.
{{% /notice %}}

To enable query logging, you must set `-v=3` which will enable verbose logging for everything. Alternatively, you can set `--vmodule=server=3` for only the dgraph/server.go file which would only enable query/mutation logging.
When enabling query logging with the `--vmodule=server=3` flag this prints the queries/mutation that Dgraph Cluster receives from Ratel, Client etc. In this case Alpha log will print something similar to:

```
I1201 13:06:26.686466 10905 server.go:908] Got a query: query:"{\n query(func: allofterms(name@en, \"Marc Caro\")) {\n uid\n name@en\n director.film\n }\n}"
```
As you can see, we got the query that Alpha received, to read it in the original DQL format just replace every `\n` with a new line, any `\t` with a tab character and `\"` with `"`:

```
{
query(func: allofterms(name@en, "Marc Caro")) {
uid
name@en
director.film
}
}
```

0 comments on commit bc41f51

Please sign in to comment.