Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import_logs give a IOError: [Errno 29] Illegal seek when receive log from pipe because we can't seek stdin in pipe mode #294

Merged
merged 1 commit into from May 27, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions misc/log-analytics/import_logs.py
Expand Up @@ -1528,7 +1528,10 @@ def detect_format(file):
logging.debug("Detecting format against line %i" % lineno)
format = Parser.check_format(line)

file.seek(0)
try:
file.seek(0)
except IOError:
pass

if not format:
fatal_error("cannot automatically determine the log format using the first %d lines of the log file. " % limit +
Expand Down Expand Up @@ -1574,7 +1577,10 @@ def invalid_line(line, reason):
data = file.read(100)
if len(data.strip()) == 0:
return
file.seek(0)
try:
file.seek(0)
except IOError:
pass

format = self.detect_format(file)
if format is None:
Expand Down