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 capability to export logs as type csv not just json. #954

Closed
1 task done
DannyPat44 opened this issue Jan 2, 2024 · 3 comments · Fixed by #955
Closed
1 task done

Add capability to export logs as type csv not just json. #954

DannyPat44 opened this issue Jan 2, 2024 · 3 comments · Fixed by #955
Labels
feature request A feature has been asked for or suggested by the community

Comments

@DannyPat44
Copy link

Checklist

Describe the problem you'd like to have solved

I was investigating some issues in our tenant and wanted to export some logs to a .csv file so we can count specific issues and share them with our customer success and support teams. Specifically, you can load the .csv to Excel, which is a friendly tool for non-developers.

Describe the ideal solution

I was able to do it, but I had to do some jq manipulation, which was a bit painful. It would be nice to have a similar flag as --json for csv or have the formatting to the log table be more straightforward to parse to .csv.

Alternatives and current workarounds

I was able to use this to build a csv file from the json output. But it took more effort than I would have liked.
auth0 logs list --filter "type: f AND date:[2023-12-25 TO 2024-01-02]" --json | jq -r '["type", "date", "description", "connection", "client_name", "user_agent"], (.[] | [.type, .date, .description, .connection, .client_name, .user_agent]) | @csv ' >> ~/Downloads/ben-logs.csv

I tried using tr and sed but found that both would not properly break the file apart with the current output formating.
auth0 logs list --filter "type: f AND date:[2023-12-25 TO 2024-01-02]" | tr "\\t" "," >> ~/Downloads/amh-logs.csv

Additional context

I love the new CLI tool. Overall, it is a great addition to help developers troubleshoot.

@DannyPat44 DannyPat44 added the feature request A feature has been asked for or suggested by the community label Jan 2, 2024
@m3talsmith
Copy link
Contributor

@DannyPat44 I'm working on a CSV export for another command and looking at generalizing the format. I'll keep logs in mind as I think it's a good fit too. Update you as it comes together.

@m3talsmith
Copy link
Contributor

@DannyPat44 #955 brings the --csv flag to logs and all the rest of our table result-based commands. This should be merged today into the main branch and make it into the next release.

An example of using it in your case would be:

auth0 logs list --filter "type: f AND date:[2023-12-25 TO 2024-01-02]" --csv > ~/Downloads/ben-logs.csv

@DannyPat44
Copy link
Author

Wow, that was so quick! Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request A feature has been asked for or suggested by the community
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants