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

add log tailing to logfetch tool #383

Merged
merged 7 commits into from
Jan 9, 2015
Merged

add log tailing to logfetch tool #383

merged 7 commits into from
Jan 9, 2015

Conversation

ssalinas
Copy link
Member

@ssalinas ssalinas commented Jan 7, 2015

@tpetr @wsorenson
This will add the ability to tail logs for a request, task, or request/deploy when the --tail option is specified with a logfile path (ie. 'logs/access.log'). It will also take the -g grep option and pas that through to the api as well.

If --tail isn't specified the tool will download and grep as before.

@@ -70,7 +74,8 @@ def entrypoint():
parser.add_argument("-u", "--singularity-uri-base", help="The base for singularity (eg. http://localhost:8080/singularity/v1)", metavar="URI")
parser.add_argument("-s", "--start-days", help="Search for logs no older than this many days", type=int, metavar="start_days")
parser.add_argument("-e", "--end-days", help="Search for logs no new than this many days (defaults to None/today)", type=int, metavar="end_days")
parser.add_argument("-g", "--grep", help="Regex to grep for (normal grep syntax) or a full grep command", metavar='grep')
parser.add_argument("-g", "--grep", help="Regex to grep for (normal grep syntax) or a full grep command(cannot use full command with --tail)", metavar='grep')
parser.add_argument("--tail", help="Logfile name to tail, if this is set, no downloads will happen", metavar="tail")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we mimic the tail command and use -t as well (make people think less)?

@tpetr
Copy link
Contributor

tpetr commented Jan 7, 2015

what happens then a request churns through tasks (i.e. OOM kill / misc. failure / bounce / deploy)? right now we won't pick up new tasks -- if we're cool with that, we need to make it very clear in the docs

@tpetr
Copy link
Contributor

tpetr commented Jan 7, 2015

i'd almost prefer to have a 2nd entrypoint (logtail) instead of the --tail arg, which completely changes the functionality of the program

@ssalinas
Copy link
Member Author

ssalinas commented Jan 7, 2015

I've made logtail it's own entrypoint and reworked the threading a bit, we were using -t for the taskId already so for right now I made -l the logfile name to tail

parser.add_argument("-d", "--deployId", help="DeployId of task to fetch logs for", metavar="deployId")
parser.add_argument("-u", "--singularity-uri-base", help="The base for singularity (eg. http://localhost:8080/singularity/v1)", metavar="URI")
parser.add_argument("-s", "--start-days", help="Search for logs no older than this many days", type=int, metavar="start_days")
parser.add_argument("-e", "--end-days", help="Search for logs no new than this many days (defaults to None/today)", type=int, metavar="end_days")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

start and end is unnecessary for tail, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was previously used for filtering our really old historical tasks, realizing we won't need those for tailing live logs, I'll remove those and the piece that fetches historical tasks as well

@tpetr
Copy link
Contributor

tpetr commented Jan 7, 2015

re: #383 (comment) -- totally overlooked -t being for task id, right

@ssalinas
Copy link
Member Author

ssalinas commented Jan 8, 2015

Tailing should be all set now, I've trimmed the arguments down to just the IDs, logfile, and grep string (along with the base uri/conf file stuff). I left the logfile arg as giving an error message if it is not set.

tpetr added a commit that referenced this pull request Jan 9, 2015
add log tailing to logfetch tool
@tpetr tpetr merged commit f8a2382 into master Jan 9, 2015
@ssalinas ssalinas deleted the log_tail branch May 4, 2015 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants