https://github.com/fiverr/node-es-slow-log-parse
Parse Elasticsearch log lines
https://github.com/fiverr/node-es-slow-log-parse
aws elasticsearch log parse slowlog
Last synced: about 1 year ago
JSON representation
Parse Elasticsearch log lines
- Host: GitHub
- URL: https://github.com/fiverr/node-es-slow-log-parse
- Owner: fiverr
- Created: 2019-09-04T13:02:17.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-03-21T22:51:48.000Z (over 3 years ago)
- Last Synced: 2025-04-04T18:11:19.635Z (about 1 year ago)
- Topics: aws, elasticsearch, log, parse, slowlog
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/es-slow-log-parse
- Size: 8.79 KB
- Stars: 4
- Watchers: 42
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# es-slow-log-parse [](https://circleci.com/gh/fiverr/node-es-log-parse) 
## 📃 Elasticsearch Slow Log line parser
```js
const parse = require('es-slow-log-parse');
const payload = new Buffer(event.awslogs.data, 'base64');
const logs = JSON.parse(zlib.gunzipSync(payload).toString('ascii'));
const events = logs.map(parse); // <= ✨ Money time
```
### Example
Record
```
[2019-09-04T14:17:34,160][INFO ][index.search.slowlog.query] [es-search-data] [index_1][9] took[225.8ms], took_millis[225], types[type_1], stats[], search_type[QUERY_THEN_FETCH], total_shards[10], source[{"some":{"kind":{"of":{"complex":"json"}}}}],'
```
Result
```js
{
timestamp: '2019-09-04T14:17:34,160',
severity: 'INFO',
source: 'index.search.slowlog.query',
node: 'es-search-data',
index: 'index_1',
shard: 9,
took: '225.8ms',
took_millis: 225,
types: 'type_1',
stats: '',
search_type: 'QUERY_THEN_FETCH',
total_shards: 10,
query: '{"some":{"kind":{"of":{"complex":"json"}}}}',
}
```
### Related projects:
- [RDS Slow Log line parser](https://github.com/fiverr/node-rds-slow-log-parse)
- [MongoDB Slow Log line parser](https://github.com/fiverr/node-mongo-slow-log-parse)