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

Expand \n and \t please! #216

Open
mattes3 opened this issue Sep 7, 2021 · 1 comment
Open

Expand \n and \t please! #216

mattes3 opened this issue Sep 7, 2021 · 1 comment

Comments

@mattes3
Copy link

mattes3 commented Sep 7, 2021

Is your feature request related to a problem? Please describe.
I have difficulties to read my logs that are in JSON format. This is a sample log message, it is structured like this:

{"timestamp":"2021-09-07T08:24:40.062Z","level":"INFO","thread":"qtp1533672820-41","logger":"com.gettheaudience.somepackage.UserAppService","message":"BIZEVENT: Subscription 154 updated, new status = PAYING","context":"default"}

To read these messages, I do this:

cw tail -b2h -f -s -t -l -q '[thread, message]' my-log-group-name

This works fine.

Now the frustration comes when I read a log where the "message" field contains new-line \n and tab characters \t, typically exception stack traces generated by Java. On screen, they look like a big bunch of garbled characters because the new-line \n does not cause a line break in cw.

Describe the solution you'd like

I would like that cw gets an option that tells it to replace \n by a real line break, and \t by some number of spaces. This would make my log perfectly readable. It would be a bonus if cw used the entire rules for JSON, e.g. \" should be replaced by ", and so on.

Describe alternatives you've considered

I briefly considered using "jq" with "raw" output for this. However, jq is confused by the other fields in the output from cw, as jq does not know that there is valid JSON later in the line.

@lucagrulla
Copy link
Owner

Hi, thank you for the feature request.
This is not a top priority right now, but I would happily review a good Pull Request for merging into main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants