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

Feature/add extra fields #30

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
version: 2
jobs:

release-snapshot:
docker:
- image: cimg/node:lts
steps:
- checkout
- run: yarn install --frozen-lockfile --non-ineractive
- run:
name: Deploy
command: |
export NPM_TOKEN=${SNAPSHOT_NPM_TOKEN}
npm config set ${NPM_PACKAGE_SCOPE}:registry ${NPM_SNAPSHOT_REPO}
npx semantic-release
release:
docker:
- image: cimg/node:lts
steps:
- checkout
- run: yarn install --frozen-lockfile --non-ineractive
- run: echo "Running release job"
- run:
name: Deploy
command: npx semantic-release


workflows:
version: 2
release:
jobs:
- release-snapshot:
context: Dreamworld
filters:
branches:
only:
- /^feature\/.+$/
- release:
context: Dreamworld
filters:
branches:
only:
- master
70 changes: 0 additions & 70 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

32 changes: 0 additions & 32 deletions .github/workflows/node.js.yml

This file was deleted.

39 changes: 0 additions & 39 deletions .github/workflows/npm-publish.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,5 @@ typings/

# next.js build output
.next

package-lock.json
18 changes: 17 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ function format(logData) {
return util.format.apply(util, wrapErrorsWithInspect(logData));
}

/**
* Returns index name with given indexPrefix. e.g: `$indexPrefix-yyyymmdd`
* @param {String} indexPrefix
* @returns
*/
function _getIndexName(indexPrefix) {
var date = new Date();
var yyyy = date.getFullYear();
var mm = date.getMonth() + 1;
var dd = date.getDate();
return indexPrefix + String(10000 * yyyy + 100 * mm + dd);
}

/**
*
* For HTTP (browsers or node.js) use the following configuration params:
Expand Down Expand Up @@ -52,12 +65,15 @@ function logstashHTTPAppender(config) {
const logstashEvent = [
{
index: {
_index: config.application,
_index: config.indexPrefix && _getIndexName(config.indexPrefix) || config.application,
_type: config.logType,
},
},
{
category: event.categoryName,
message: format(event.data),
application: config.indexPrefix && config.application || config.application,
instanceId: config.instanceId,
context: event.context,
level: event.level.level / 100,
level_name: event.level.levelStr,
Expand Down
27 changes: 21 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "@log4js-node/logstash-http",
"version": "1.1.0",
"name": "@dreamworld/logstash-http",
"version": "0.0.0-development",
"description": "Logstash HTTP Appender for log4js-node",
"homepage": "https://log4js-node.github.io/log4js-node/",
"homepage": "https://github.com/DreamworldSolutions/logstashHTTP",
"files": [
"lib",
"types"
Expand All @@ -20,10 +20,10 @@
"author": "Gareth Jones <[email protected]>",
"repository": {
"type": "git",
"url": "https://github.com/log4js-node/logstashHTTP.git"
"url": "https://github.com/DreamworldSolutions/logstashHTTP.git"
},
"bugs": {
"url": "http://github.com/log4js-node/logstashHTTP/issues"
"url": "https://github.com/DreamworldSolutions/logstashHTTP/issues"
},
"engines": {
"node": ">=6.0"
Expand Down Expand Up @@ -57,7 +57,8 @@
"nyc": "^11.5.0",
"tap": "^12.0.1",
"typescript": "^4.7.2",
"validate-commit-msg": "^2.14.0"
"validate-commit-msg": "^2.14.0",
"semantic-release": "17.0.8"
},
"browser": {
"os": false
Expand Down Expand Up @@ -91,5 +92,19 @@
"require": [
"./test/sandbox-coverage"
]
},
"publishConfig": {
"access": "public"
},
"release": {
"branches": [
"+([0-9])?(.{+([0-9]),x}).x",
"master",
{
"name": "feature/*",
"prerelease": "${name.replace(/^feature\\//g, \"\")}",
"channel": "${name.replace(/^feature\\//g, \"\")}"
}
]
}
}