zhanbei / static-server

A static server in Go, supporting hosting static files in the no-trailing-slash version.
0 stars 0 forks source link

Logs may also be written to the database as it would. #5

Open zhanbei opened 5 years ago

zhanbei commented 5 years ago

Often logs are preserved not for people to read, but for machines to read and analyze.

Clearly, there are logs(#4) for real people to access, which is more readable and less(compressed) or more(designed or formatted) verbose, but more importantly, the core logs would be stored in a database for querying and analyzing later.

The format of the access or error logs does not matter as it sounds like, because the overall data a logging record carries matters, like the contents matter priority to formats as being said.

Hence once logs are serialized and stored, they are empowered to be queried and visualized into any possible formats, and even be consumed by third-party services to trigger further warnings as needed.

zhanbei commented 5 years ago

The binary may integrate the mongodb driver, and follow external configures to change behaviors.

zhanbei commented 5 years ago

The final configuration file may be something in toml like:

virtual-hosting = true
no-trailing-slash = true
directory-listing = false

[database]
enabled = true
uri = "mongodb://localhost:27020/httplogs"
collections = [ "logging.httpRequests" ]

or in yaml like:

virtual-hosting: true
no-trailing-slash: true
directory-listing: false
database:
    enabled: true
    uri: mongodb://localhost:27020/httplogs
    collections:
        - logging.httpRequests