Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] : rephrase + added example to query logging section (#7032) #7078

Merged
merged 1 commit into from
Dec 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ title = "Log Format"

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
}
}
```