Skip to content
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ venv-%:

install-%: venv-%
dev/venv-py$*/bin/pip install --ignore-requires-python --only-binary :all: ruff==0.4.10 # Synchronise this line with .circleci/config.yml
dev/venv-py$*/bin/pip install -r docs/requirements.txt -r dev/requirements.txt -e agent/ -e ui/ psycopg2-binary
dev/venv-py$*/bin/pip install -r docs/requirements.txt -r dev/requirements.txt -e agent/ -e ui/ psycopg2-binary hupper
dev/venv-py$*/bin/temboard --version # smoke test
dev/venv-py$*/bin/temboard-agent --version # smoke test

Expand Down
6 changes: 6 additions & 0 deletions agent/temboardagent/web/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ def setup(self):
raise UserError(f"Failed to setup SSL: {e}.")
self.server.timeout = 1

logger.info(
"Serving at https://%s:%s.",
self.app.config.temboard.address,
self.app.config.temboard.port,
)

# for syncio.Loop
def accept(self):
self.server.handle_request()
Expand Down
3 changes: 3 additions & 0 deletions dev/lnav/formats/temboard_log.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
"systemd": {
"pattern": "^(?<component>[.\\w]+): (?<body>.+)$",
"module-format": true
},
"prometheus": {
"pattern": "^ts=(?<timestamp>[^ ]+) caller=.+ level=(?<level>[a-z]{4,}) (?<body>.+)$"
}
},
"value": {
Expand Down
16 changes: 9 additions & 7 deletions ui/temboardui/toolkit/log.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import datetime
import logging
import sys
import time
from logging.config import dictConfig
from logging.handlers import SysLogHandler

Expand Down Expand Up @@ -132,17 +133,12 @@ def generate_logging_config(
stderr_handler = "logging.StreamHandler"
if sys.stderr.isatty():
stderr_handler = __name__ + ".ColoredStreamHandler"
timestamp = "%(asctime)s "
datefmt = "%H:%M:%S"
else:
# strftime does not support milliseconds. Modifying datefmt disables Python hack
# to append milliseconds to timestamp. Thus, hardcode timezone in message format
# rather than datefmt.
timestamp = "%(asctime)s " + localoffset() + " "
datefmt = None

minimal_fmt = "%(levelname)s: %(lastname)s: %(message)s"
verbose_fmt = timestamp + core + "[%(process)d] " + minimal_fmt
verbose_fmt = "%(asctime)s " + core + "[%(process)d] " + minimal_fmt
syslog_fmt = core + "[%(process)d] %(levelname)s: %(lastname)s: %(message)s"

logging_config = {
Expand All @@ -157,7 +153,7 @@ def generate_logging_config(
},
"dated_syslog": {
"()": __name__ + ".MultilineFormatter",
"format": timestamp + syslog_fmt,
"format": "%(asctime)s " + syslog_fmt,
},
"syslog": {"()": __name__ + ".MultilineFormatter", "format": syslog_fmt},
"systemd": {
Expand Down Expand Up @@ -193,3 +189,9 @@ def localoffset():
hours = offset.seconds // 3600
minutes = (offset.seconds // 60) % 60
return "+%02d%02d" % (hours, minutes)


# Make logging format consistent with Prometheus ts= format.
logging.Formatter.converter = time.gmtime
logging.Formatter.default_time_format = "%Y-%m-%dT%H:%M:%S"
logging.Formatter.default_msec_format = "%s.%03dZ" # Append UTC timezone.
2 changes: 1 addition & 1 deletion ui/temboardui/toolkit/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def sigchld_handler(self, *a):
pass

logger.warning(
"Background service dead. Restarting service=%s pid=%s",
"Background service dead. Restarting. service=%s pid=%s",
name,
self.pids[name],
)
Expand Down