LogServer
The Go server for monitoring log files.
Install
go get -U github.com/moisespsena/logserver
cd $GOPATH/src/github.com/moisespsena/logserver
go build
Run
./logserver
Access http://localhost:4000/file/test.log
Configuration
The sample configurarion file is conf/sample.ini
.
Or
./logserver -sampleConfig
For customize configurations and show it:
./logserver -conf conf/sample.init -printConfig
CLI Options
./logserver -h
Usage of ./logserver:
-config string
The Config File. Example: cfg.init
-printConfig
Print Default INI Config
-sampleConfig
Print Sample INI Config
Nginx Proxy Pass Example
Your serverUrl
config example:
...
serverUrl = PROTO://HOST/sub/path
serverAddr = 127.0.0.1:4000
...
Nginx conf:
location /sub/path/ws/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade websocket;
proxy_set_header Connection upgrade;
proxy_set_header Host $host:$server_port;
proxy_set_header Origin $scheme://$host:$server_port;
proxy_http_version 1.1;
proxy_pass http://localhost:4000;
# proxy_pass http://unix:/var/run/logger.sock;
}
location /sub/path {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host:$server_port;
proxy_set_header Origin $scheme://$host:$server_port;
proxy_http_version 1.1;
proxy_pass http://localhost:4000;
# proxy_pass http://unix:/var/run/logger.sock;
}