diff options
author | Christian Pointner <equinox@spreadspace.org> | 2014-10-12 22:33:10 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2014-10-12 22:33:10 +0200 |
commit | 79bb8c38357b602a958235f13f5fe2ce8b0d5fe2 (patch) | |
tree | bd43bfaa1d699516b06d3fc1d5c67570f3067a0c /src/daq/accesslog/sfive-accesslog.py | |
parent | parsing data from log lines works now (diff) |
also allow stdin as logfile
Diffstat (limited to 'src/daq/accesslog/sfive-accesslog.py')
-rwxr-xr-x | src/daq/accesslog/sfive-accesslog.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/daq/accesslog/sfive-accesslog.py b/src/daq/accesslog/sfive-accesslog.py index 94a0309..e88d7e4 100755 --- a/src/daq/accesslog/sfive-accesslog.py +++ b/src/daq/accesslog/sfive-accesslog.py @@ -36,6 +36,7 @@ from twisted.internet import protocol, reactor, unix import socket from time import sleep +import sys import re import simplejson as json import datetime @@ -118,7 +119,7 @@ class AccessLog(): def _initLog(self): try: - self._fd = open(self._logfile, 'r') + self._fd = open(self._logfile, 'r') if self._logfile != '-' else sys.stdin regex = self._nameformat % { 'hostname': self._hostname, 'content-id': self._content_id, 'format': self._format, @@ -248,7 +249,7 @@ if __name__ == '__main__': parser.add_argument('--tag', '-t', dest='tags', action='append', help='tag to be added to the statistic data, can be invoked several times') parser.add_argument('--logfile', '-l', dest='logfile', required=True, - help='path to the logfile') + help='path to the logfile or \'-\' for standard input') parser.add_argument('--nameformat', '-F', dest='nameformat', required=True, help='the format for filenames which are part of this stream, this may include python string expressions') args = vars(parser.parse_args()) |