logagent-js
Advanced tools
Comparing version 1.2.23 to 1.2.24
@@ -50,2 +50,3 @@ #!/bin/sh | ||
.option('-g, --glob <globPattern>', 'glob pattern to match file names') | ||
.option('--tailStartPosition <pos>', '-1 tail from end of file, >=0 start from given position (in bytes)') | ||
.option('-s, --suppress', 'supress output of parsed log lines') | ||
@@ -117,3 +118,3 @@ .option('-y, --yaml', 'print parsed logs in YAML format to stdout') | ||
if (argv.glob || argv.args.length>0) { | ||
fileManager = new TailFileManager({parseLine: parseLine, log: log}) | ||
fileManager = new TailFileManager({parseLine: parseLine, log: log, startPos: Number(argv.tailStartPosition)}) | ||
} | ||
@@ -120,0 +121,0 @@ |
@@ -20,2 +20,3 @@ ## Command Line Parameters for logagent | ||
| -g glob-pattern | use a [glob](https://www.npmjs.com/package/glob) pattern to watch log files e.g. ```-g "{/var/log/*.log,/Users/stefan/myapp/*.log}"```. The complete glob expression must be quoted, to avoid interpretation of special characters by the linux shell. | | ||
| --tailStartPosition bytes | -1 tail from end of file, >=0 start from given position (in bytes). This setting applys for new files, having no position saved (see --logsene-tmp-dir)| | ||
| --stdin | read from stdin, default if no other input like files or UDP are set| | ||
@@ -22,0 +23,0 @@ | -n name | name for the log source only when stdin is used, important to make multi-line patterns working on stdin because the status is tracked by the log source name.| |
@@ -41,3 +41,7 @@ 'use strict' | ||
// tail from end of file | ||
return {start: getFilesizeInBytes(file)} | ||
if (this.options.startPos === -1) { | ||
return {start: getFilesizeInBytes(file)} | ||
} else { | ||
return {start: this.options.startPos} | ||
} | ||
} else { | ||
@@ -44,0 +48,0 @@ var fd = fs.openSync(file, 'r') |
{ | ||
"name": "logagent-js", | ||
"version": "1.2.23", | ||
"version": "1.2.24", | ||
"description": "Smart log parser written in Node", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
115800
1406