Last active
May 25, 2018 08:22
-
-
Save deptno/df8093be6022d3e1fd208b711598e73e to your computer and use it in GitHub Desktop.
aws-cwlog cloudwatch log transform oneline format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// aws-cwlog trnasform script <https://www.npmjs.com/package/aws-cwlog> | |
// CloudWatch Log to oneline format eg."2018-05-25T04:41:58 log message" | |
map( | |
pipe( | |
dissoc('ingestionTime'), | |
over( | |
lensProp('timestamp'), | |
pipe( | |
x => new Date(x).toISOString(), | |
slice(0, -5), | |
) | |
), | |
over( | |
lensProp('message'), | |
pipe( | |
tryCatch(JSON.parse, identity), | |
) | |
), | |
x => `${x.timestamp} ${pipe(prop('msg'), JSON.stringify)(x.message)}` | |
), | |
) |
Author
deptno
commented
May 25, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment