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

New command to read accesslogs of an application #360

Closed
urcadox opened this issue Dec 20, 2019 · 3 comments · Fixed by #364
Closed

New command to read accesslogs of an application #360

urcadox opened this issue Dec 20, 2019 · 3 comments · Fixed by #364

Comments

@urcadox
Copy link
Contributor

urcadox commented Dec 20, 2019

Now that accesslogs are available to the users in Warp10, we could add a command in clever-tools to make this easier.
It would need to first get a Warp10 token from the API and then query Warp10.
About the API, I guess something like this would be fine:

  • clever accesslogs --since <date> --until <date> --limit <number>
  • clever accesslogs --follow (-f for short)

The follow feature may not be that useful and may not be so trivial to implement without dumping multiple-seconds batches all at once in the console, so I'm not sure that we should do it, not at first at least. The actually useful feature is the since/until one, it seems to me.

@hsablonniere
Copy link
Member

Do we have an idea of the format people expect for such kind of things? We do have a lot of details in Warp10.

@divarvel
Copy link
Contributor

CLF support seems a good option (https://en.wikipedia.org/wiki/Common_Log_Format) for starters

@urcadox
Copy link
Contributor Author

urcadox commented Feb 7, 2020

I'm working on a PR for this.

Here are the formats and defaults for before / after I went with:

Formats

simple

2020-02-07T14:00:00+01:00 92.184.110.25 GET /ping

extended

2020-02-07T14:00:00+01:00 [ 92.184.110.25 - Bordeaux, FR ] GET console.clever-cloud.com /ping 304

clf

92.184.110.25 - - [07/Feb/2020:14:00:00 +0100] "GET /ping -" 304 203

json

{"t":"2020-02-07T13:00:00.146987Z","a":"app_1246f211-d4a7-4787-ba62-56c163a8b4ef","adc":"clevercloud-adc-n6","o":"orga_858600a8-74f4-4d75-a8a3-f5b868be093c","i":"f9ed5548-b196-4da5-9243-645a9c3a5e94","ipS":"92.184.110.25","pS":43341,"s":{"lt":44.8412,"lg":-0.5806,"ct":"Bordeaux","co":"FR"},"ipD":"46.252.181.39","pD":14721,"d":{"lt":48.7967,"lg":2.3338,"ct":"Cachan","co":"FR"},"vb":"GET","path":"/ping","bIn":926,"bOut":203,"h":"console.clever-cloud.com","rTime":"62ms","sTime":"81μs","scheme":"HTTPS","sC":304,"sT":"Not Modified","w":"WRK-00","r":"82cb0eb4-c4b5-4115-8f41-ee4b9a252ae7"}

A user can always pick the json format and output what they want with jq.

Defaults for before/after

  • Both undefined: return the last hour of logs
  • After undefined: return 1 hour of logs before the before timestamp
  • Before undefined: return all the logs from the after timestamp up until now

Any thoughts about this?

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 a pull request may close this issue.

3 participants