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

Rmoore/fix index config #53

Merged
merged 5 commits into from
Aug 7, 2020
Merged
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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Running the Fabric Logger in Docker is recommended. A sample docker-compose entr
services:
fabric-logger.example.com:
container_name: fabric-logger.example.com
image: splunkdlt/fabric-logger:release-2.0.1
image: splunkdlt/fabric-logger:release-2.0.2
environment:
- FABRIC_KEYFILE=<path to private key file>
- FABRIC_CERTFILE=<path to signed certificate>
Expand Down Expand Up @@ -113,8 +113,8 @@ We also include a helm chart for Kubernetes deployments. First set your `values.

Alternatively, if you are using `cryptogen` to generate identities, the helm chart can auto-populate secrets for you. You will need to download the helm file and untar it locally so you can copy your `crypto-config` into the director.

wget https://github.com/splunk/fabric-logger/releases/download/v1.2.0/fabric-logger-helm-v1.2.0.tgz
tar -xf fabric-logger-helm-v1.2.0.tgz
wget https://github.com/splunk/fabric-logger/releases/download/2.0.2/fabric-logger-helm-v2.0.2.tgz
tar -xf fabric-logger-helm-v2.0.2.tgz
cp -R crypto-config fabric-logger/crypto-config

Set the secrets section of `values.yaml` to:
Expand Down Expand Up @@ -145,7 +145,7 @@ A `network.yaml` will automatically be generated using the secrets and channel d

helm install -n fabric-logger-${PEER_NAME}-${NS} --namespace ${NS} \
-f values.yaml \
https://github.com/splunk/fabric-logger/releases/download/v2.0.1/fabric-logger-helm-v2.0.1.tgz
https://github.com/splunk/fabric-logger/releases/download/v2.0.2/fabric-logger-helm-v2.0.2.tgz

### Kubernetes: Deleting Helm Chart

Expand Down
2 changes: 1 addition & 1 deletion defaults.fabriclogger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ hec:
userAgent: fabric_logger-hec-client/$VERSION
multipleMetricFormatEnabled: false
waitForAvailability: 2m
index: hyperledger_logs
retryWaitTime:
type: exponential-backoff
min: 10ms
max: 3m
defaultMetadata:
host: $HOSTNAME
source: fabric_logger
index: hyperledger_logs
internal:
flushTime: 5s
defaultMetadata:
Expand Down
4 changes: 2 additions & 2 deletions helm-chart/fabric-logger/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v1
appVersion: "v2.0.1"
appVersion: "v2.0.2"
description: A Helm chart for Splunk Connect for Hyperledger Fabric
name: fabric-logger
version: v2.0.1
version: v2.0.2
keywords:
- blockchain
- hyperledger
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fabric-logger",
"version": "2.0.1",
"version": "2.0.2",
"description": "Hyperledger Fabric Splunk integration",
"author": "splunk <blockchain@splunk.com>",
"main": "lib/index.js",
Expand Down
4 changes: 3 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,9 @@ export async function loadFabricloggerConfig(flags: CliFlags, dryRun: boolean =
),
token: required('hec-token', defaults.hec?.default?.token),
defaultFields: defaults.hec?.default?.defaultFields,
defaultMetadata: defaults.hec?.default?.defaultMetadata,
defaultMetadata: flags['hec-events-index']
? Object.assign({}, defaults.hec?.default?.defaultMetadata, { index: flags['hec-events-index'] })
: defaults.hec?.default?.defaultMetadata,
flushTime: parseDuration(defaults.hec?.default?.flushTime),
gzip: defaults.hec?.default?.gzip,
maxQueueEntries: defaults.hec?.default?.maxQueueEntries,
Expand Down
7 changes: 6 additions & 1 deletion src/fabric.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { ManagedResource } from '@splunkdlt/managed-resource';
import { retry, exponentialBackoff } from '@splunkdlt/async-tasks';
import { readFile } from 'fs-extra';

const { debug, info, error } = createModuleDebug('fabric');
const { debug, info, error, warn } = createModuleDebug('fabric');

export class FabricListener implements ManagedResource {
private client: FabricClient | undefined;
Expand Down Expand Up @@ -101,6 +101,11 @@ export class FabricListener implements ManagedResource {
}
}
}
if (Object.keys(this.config.channels).length === 0 && Object.keys(this.config.ccevents).length === 0) {
warn(
'No Channels or events are configured for listening. Please update your fabriclogger.yaml config file to include channels or chaincode events to listen on.'
);
}
}

private getChannelType(data: FabricClient.BlockData): string {
Expand Down