I am debugging some client issue in my JS code (or...
# community-help
n
I am debugging some client issue in my JS code (or in Typesense JS client). So I decided to look into Typesense server access logs. I enabled logging (access log) this way: in
/etc/typesense/typesense-server.ini
Copy code
[server]
...
log-dir = /var/log/typesense
enable-search-logging = true
enable-access-logging = true
And after this - I see in the access log:
/var/log/typesense/typesense-access.log
:
Copy code
724926899904    127.0.0.1       OPTIONS /collections/r4/documents/search
1724926899908   127.0.0.1       GET /collections/r4/documents/search
1724926994767   127.0.0.1       OPTIONS /collections/r4/documents/search
1724926994772   127.0.0.1       GET /collections/r4/documents/search
Well, this is not much. Documentation say that
enable-search-logging
: > "Logs the search API request + payload right at the start of search request lifecycle" Well... something is not OK here. For debugging I would like to see everything that comes from a client...
k
Only access logging entries are in
typesense-access.log
file. The search logging entries will be in regular log file.
n
OK, I see these things:
Copy code
I20240829 15:11:14.774144 50772 http_server.cpp:494] event=search_request, client_ip=127.0.0.1, endpoint=GET /collections/r4/documents/search?collection=r4&drop_tokens_threshold=0&exclude_fields=embedding&filter_by=...
Still, there are some issues with this: 1. This is not documented, I have to ask it here
k
n
2. it's not very convenient I mean - access log in one file, search details in another file - search details are mixed with internal server events. And as a user - i have no control about this. How can I turn off all these internal server events in log? I would like to have internal server events in one place and everything coming from/to client - in another place
The flag is documented ...
Would be great to document what goes into which log file, how many log files could be... and how to control (log levels?) content of log files...
k
Most applications have only a single logging file (maybe one optionally for access logging). That's the same convention we follow. Creating and writing too many independent log files are not convenient when you want to correlate an issue across all events in the system. You can setup a log aggregator that filters for specific events using regexp patterns. That's the standard practice.
n
Something like log level for internal server things? I want to set such log level to ERROR and see only errors
k
You can setup a logging aggregator that only looks at lines that begin with
E
-- those are the error logs.
n
If we talking about logs: in case I setup some kind of log rotation for files in
/var/log/typesense
(Linux has software for this) any restrictions/best practices for this? These log rotation programs might, for example, move/delete the file typesense process writing...
> setup a logging aggregator that only looks at lines that begin with
E
By the way - please document the format of the log file. I see lot of lines starting with
I
- looks like "`INFO`".
E
means
ERROR
What else is possible? I should not guess - it should be possible to read documentation about this.
k
Yes
I
for info,
E
for error, which is again standard logging convention, so we don't document it. You can use https://vector.dev/ to build simple rules to send events that you need to another file or destination.
1