Simple CLI tool for fetching file data or log entries from remote host.
$ go get github.com/iobestar/logship/cmd/logship
Note: It is recommended to have GO111MODULE=on
to ensure the correct
dependencies are used.
Logship in server mode serves file data in form of log units. Log unit identifies
group of files based on glob pattern. Log unit is defined with id and glob pattern.
Configuration file (logship.yml):
log_units:
- id: service_error
glob: /var/log/myservice/error.log*
- id: service_output
glob: /var/log/myservice/outout.log*
Run logship server:
$ logship server --address=":11034" --logunits="myservice_error:/var/log/myservice/error.log*:myservice_output:/var/log/myservice/output.log*"
Run as logship server as Docker:
$ docker run --name=logship -p 11034:11034 -v "/var/log/myservice":"/var/log/myservice" -e LOGSHIP_CONFIG="<logship.yml>" -d iobestar/logship
logship client --help
$ logship --target=localhost:11034
target: logship server address
$ logship --target=localhost:11034 nlines <unit> <number_of_lines>
target: logship server address
unit: id of log unit
number_of_lines: count of lines
$ logship --target=localhost:11034 nlogs <unit> <number_of_logs> <reader_id>
config: configuration path
target: logship server address
unit: id of log unit
number_of_logs: count of logs
$ logship --target=localhost:11034 tlogs <unit> <duration> <reader_id>
config: configuration path
target: logship server address
unit: id of log unit
duration: "1s", "10m", "5h"