{"flowContents":{"identifier":"afb46297-767d-303f-901d-99bcdb04821c","name":"Extract Bulletins To Table","comments":"","position":{"x":1664.0,"y":-1168.0},"processGroups":[{"identifier":"c4583d0f-5de7-30c7-978b-be97c8e4605e","name":"Extract Bulletins","comments":"","position":{"x":1944.4965512309457,"y":-96.31511474933723},"processGroups":[],"remoteProcessGroups":[],"processors":[{"identifier":"1b17589c-02d4-3bab-9d3b-3bf6c7e446a4","name":"Get Recent Bulletin Summary","comments":"","position":{"x":984.0,"y":256.0},"bundle":{"group":"org.apache.nifi","artifact":"nifi-standard-nar","version":"1.15.2.2.1.3.0-125"},"style":{"background-color":"#3dae2b"},"type":"org.apache.nifi.processors.standard.ExecuteSQLRecord","properties":{"esql-max-rows":"0","esqlrecord-record-writer":"2f6f853f-9b90-3af6-9d8b-698587104e49","dbf-default-precision":"10","Max Wait Time":"0 seconds","Database Connection Pooling Service":"133001f1-109a-3d50-b479-03b37577a57d","sql-post-query":null,"dbf-user-logical-types":"false","dbf-default-scale":"0","sql-pre-query":null,"esql-output-batch-size":"0","esql-fetch-size":"0","SQL select query":"SELECT \n bulletinlevel AS \"Level\"\n, SUBSTRING(bulletingrouppath, '[^/]+ / (.*)') as \"Process_Group_Path\"\n, bulletinsourcename AS \"Processor_Name\"\n, COUNT(*) as \"Count\"\n, filter_where_clause\n, notification_to\nFROM #{monitoring_schema}.monitoring_bulletins\nCROSS JOIN (\nSELECT filter_where_clause, notification_to, notification_cc from #{monitoring_schema}.notification_filters WHERE notification_type = '${bulletin_job_type}'\nUNION ALL\nSELECT '/* ALL */' AS filter_where_clause, '${to_recipient}' AS notification_to, '${cc_recipient}' AS notification_cc\n) f\nWHERE bulletincategory = 'Log Message'\n --AND to_timestamp(bulletintimestamp/1000) > DATE(NOW())\n AND bulletintimestamp >= ${start.ts}::bigint * 1000\n AND bulletintimestamp <= ${end.ts}::bigint * 1000\n AND bulletingroupname NOT IN ( ${excluded.group.names} )\nGROUP BY bulletinlevel, bulletingrouppath, bulletinsourcename, filter_where_clause, notification_to\nORDER BY filter_where_clause, notification_to, \"Process_Group_Path\", \"Processor_Name\"","esqlrecord-normalize":"false"},"propertyDescriptors":{"esql-max-rows":{"name":"esql-max-rows","displayName":"Max Rows Per Flow File","identifiesControllerService":false,"sensitive":false},"esqlrecord-record-writer":{"name":"esqlrecord-record-writer","displayName":"Record Writer","identifiesControllerService":true,"sensitive":false},"dbf-default-precision":{"name":"dbf-default-precision","displayName":"Default Decimal Precision","identifiesControllerService":false,"sensitive":false},"Max Wait Time":{"name":"Max Wait Time","displayName":"Max Wait Time","identifiesControllerService":false,"sensitive":false},"Database Connection Pooling Service":{"name":"Database Connection Pooling Service","displayName":"Database Connection Pooling Service","identifiesControllerService":true,"sensitive":false},"sql-post-query":{"name":"sql-post-query","displayName":"SQL Post-Query","identifiesControllerService":false,"sensitive":false},"dbf-user-logical-types":{"name":"dbf-user-logical-types","displayName":"Use Avro Logical Types","identifiesControllerService":false,"sensitive":false},"dbf-default-scale":{"name":"dbf-default-scale","displayName":"Default Decimal Scale","identifiesControllerService":false,"sensitive":false},"sql-pre-query":{"name":"sql-pre-query","displayName":"SQL Pre-Query","identifiesControllerService":false,"sensitive":false},"esql-output-batch-size":{"name":"esql-output-batch-size","displayName":"Output Batch Size","identifiesControllerService":false,"sensitive":false},"esql-fetch-size":{"name":"esql-fetch-size","displayName":"Fetch Size","identifiesControllerService":false,"sensitive":false},"SQL select query":{"name":"SQL select query","displayName":"SQL select query","identifiesControllerService":false,"sensitive":false},"esqlrecord-normalize":{"name":"esqlrecord-normalize","displayName":"Normalize Table/Column Names","identifiesControllerService":false,"sensitive":false}},"schedulingPeriod":"0 sec","schedulingStrategy":"TIMER_DRIVEN","executionNode":"ALL","penaltyDuration":"30 sec","yieldDuration":"1 sec","bulletinLevel":"WARN","runDurationMillis":0,"concurrentlySchedulableTaskCount":1,"autoTerminatedRelationships":["failure"],"scheduledState":"ENABLED","componentType":"PROCESSOR","groupIdentifier":"c4583d0f-5de7-30c7-978b-be97c8e4605e"},{"identifier":"0368b198-e5c7-3b28-bd82-d104eae149bb","name":"Filter by Recipient","comments":"","position":{"x":984.0,"y":1176.0},"bundle":{"group":"org.apache.nifi","artifact":"nifi-standard-nar","version":"1.15.2.2.1.3.0-125"},"style":{},"type":"org.apache.nifi.processors.standard.QueryRecord","properties":{"Filtered Results":"SELECT * FROM FLOWFILE\n${filter_where_clause}","cache-schema":"true","dbf-default-precision":"10","record-writer":"5f744dea-a441-345b-9709-f66680f00829","record-reader":"a6e11450-5e14-3476-867b-eaba7786a8f6","include-zero-record-flowfiles":"false","dbf-default-scale":"0"},"propertyDescriptors":{"Filtered Results":{"name":"Filtered Results","displayName":"Filtered Results","identifiesControllerService":false,"sensitive":false},"cache-schema":{"name":"cache-schema","displayName":"Cache Schema","identifiesControllerService":false,"sensitive":false},"dbf-default-precision":{"name":"dbf-default-precision","displayName":"Default Decimal Precision","identifiesControllerService":false,"sensitive":false},"record-writer":{"name":"record-writer","displayName":"Record Writer","identifiesControllerService":true,"sensitive":false},"record-reader":{"name":"record-reader","displayName":"Record Reader","identifiesControllerService":true,"sensitive":false},"include-zero-record-flowfiles":{"name":"include-zero-record-flowfiles","displayName":"Include Zero Record FlowFiles","identifiesControllerService":false,"sensitive":false},"dbf-default-scale":{"name":"dbf-default-scale","displayName":"Default Decimal Scale","identifiesControllerService":false,"sensitive":false}},"schedulingPeriod":"0 sec","schedulingStrategy":"TIMER_DRIVEN","executionNode":"ALL","penaltyDuration":"30 sec","yieldDuration":"1 sec","bulletinLevel":"WARN","runDurationMillis":0,"concurrentlySchedulableTaskCount":1,"autoTerminatedRelationships":["original","failure"],"scheduledState":"ENABLED","componentType":"PROCESSOR","groupIdentifier":"c4583d0f-5de7-30c7-978b-be97c8e4605e"},{"identifier":"ea070129-c96d-31ad-b107-03c85c5be935","name":"Split by Potential Recipients","comments":"","position":{"x":984.0,"y":440.0},"bundle":{"group":"org.apache.nifi","artifact":"nifi-standard-nar","version":"1.15.2.2.1.3.0-125"},"style":{"background-color":"#aada91"},"type":"org.apache.nifi.processors.standard.PartitionRecord","properties":{"record-writer":"2f6f853f-9b90-3af6-9d8b-698587104e49","record-reader":"74b2bea2-23cb-32c1-a0b6-ba8f55f30e6d","filter_where_clause":"/filter_where_clause","notification_to":"/notification_to"},"propertyDescriptors":{"record-writer":{"name":"record-writer","displayName":"Record Writer","identifiesControllerService":true,"sensitive":false},"record-reader":{"name":"record-reader","displayName":"Record Reader","identifiesControllerService":true,"sensitive":false},"filter_where_clause":{"name":"filter_where_clause","displayName":"filter_where_clause","identifiesControllerService":false,"sensitive":false},"notification_to":{"name":"notification_to","displayName":"notification_to","identifiesControllerService":false,"sensitive":false}},"schedulingPeriod":"0 sec","schedulingStrategy":"TIMER_DRIVEN","executionNode":"ALL","penaltyDuration":"30 sec","yieldDuration":"1 sec","bulletinLevel":"WARN","runDurationMillis":0,"concurrentlySchedulableTaskCount":1,"autoTerminatedRelationships":["original","failure"],"scheduledState":"ENABLED","componentType":"PROCESSOR","groupIdentifier":"c4583d0f-5de7-30c7-978b-be97c8e4605e"},{"identifier":"b9b05efe-5307-33c1-870f-14b74c7bc3bb","name":"Get Bulletin Details","comments":"","position":{"x":984.0,"y":992.0},"bundle":{"group":"org.apache.nifi","artifact":"nifi-standard-nar","version":"1.15.2.2.1.3.0-125"},"style":{"background-color":"#3dae2b"},"type":"org.apache.nifi.processors.standard.ExecuteSQLRecord","properties":{"esql-max-rows":"0","esqlrecord-record-writer":"5f744dea-a441-345b-9709-f66680f00829","dbf-default-precision":"10","Max Wait Time":"0 seconds","Database Connection Pooling Service":"133001f1-109a-3d50-b479-03b37577a57d","sql-post-query":null,"dbf-user-logical-types":"false","dbf-default-scale":"0","sql-pre-query":null,"esql-output-batch-size":"0","esql-fetch-size":"0","SQL select query":"SELECT \n to_char(to_timestamp(bulletintimestamp/1000) AT TIME ZONE 'America/Los_Angeles', 'YYYY-MM-DD HH24:MI:SS') AS \"Bulletin_Time\"\n, bulletinlevel AS \"Level\"\n, SUBSTRING(bulletingrouppath, '[^/]+ / (.*)') AS \"Process_Group_Path\"\n, bulletinsourcename AS \"Processor_Name\"\n, bulletinmessage AS \"Message\"\nFROM #{monitoring_schema}.monitoring_bulletins\nWHERE bulletincategory = 'Log Message'\n --AND to_timestamp(bulletintimestamp/1000) > DATE(NOW())\n AND bulletintimestamp >= ${start.ts}::bigint * 1000\n AND bulletintimestamp <= ${end.ts}::bigint * 1000\n AND bulletingroupname NOT IN ( ${excluded.group.names} )\nORDER BY \"Process_Group_Path\", \"Processor_Name\", \"Bulletin_Time\"\nLIMIT 500","esqlrecord-normalize":"false"},"propertyDescriptors":{"esql-max-rows":{"name":"esql-max-rows","displayName":"Max Rows Per Flow File","identifiesControllerService":false,"sensitive":false},"esqlrecord-record-writer":{"name":"esqlrecord-record-writer","displayName":"Record Writer","identifiesControllerService":true,"sensitive":false},"dbf-default-precision":{"name":"dbf-default-precision","displayName":"Default Decimal Precision","identifiesControllerService":false,"sensitive":false},"Max Wait Time":{"name":"Max Wait Time","displayName":"Max Wait Time","identifiesControllerService":false,"sensitive":false},"Database Connection Pooling Service":{"name":"Database Connection Pooling Service","displayName":"Database Connection Pooling Service","identifiesControllerService":true,"sensitive":false},"sql-post-query":{"name":"sql-post-query","displayName":"SQL Post-Query","identifiesControllerService":false,"sensitive":false},"dbf-user-logical-types":{"name":"dbf-user-logical-types","displayName":"Use Avro Logical Types","identifiesControllerService":false,"sensitive":false},"dbf-default-scale":{"name":"dbf-default-scale","displayName":"Default Decimal Scale","identifiesControllerService":false,"sensitive":false},"sql-pre-query":{"name":"sql-pre-query","displayName":"SQL Pre-Query","identifiesControllerService":false,"sensitive":false},"esql-output-batch-size":{"name":"esql-output-batch-size","displayName":"Output Batch Size","identifiesControllerService":false,"sensitive":false},"esql-fetch-size":{"name":"esql-fetch-size","displayName":"Fetch Size","identifiesControllerService":false,"sensitive":false},"SQL select query":{"name":"SQL select query","displayName":"SQL select query","identifiesControllerService":false,"sensitive":false},"esqlrecord-normalize":{"name":"esqlrecord-normalize","displayName":"Normalize Table/Column Names","identifiesControllerService":false,"sensitive":false}},"schedulingPeriod":"0 sec","schedulingStrategy":"TIMER_DRIVEN","executionNode":"ALL","penaltyDuration":"30 sec","yieldDuration":"1 sec","bulletinLevel":"WARN","runDurationMillis":0,"concurrentlySchedulableTaskCount":1,"autoTerminatedRelationships":["failure"],"scheduledState":"ENABLED","componentType":"PROCESSOR","groupIdentifier":"c4583d0f-5de7-30c7-978b-be97c8e4605e"},{"identifier":"b3fd08a6-549a-3b1b-9f0f-c0133ff733d5","name":"Filter by Recipient and Drop Empty","comments":"","position":{"x":984.0,"y":624.0},"bundle":{"group":"org.apache.nifi","artifact":"nifi-standard-nar","version":"1.15.2.2.1.3.0-125"},"style":{},"type":"org.apache.nifi.processors.standard.QueryRecord","properties":{"Filtered Results":"SELECT * FROM FLOWFILE\n${filter_where_clause}","cache-schema":"true","dbf-default-precision":"10","record-writer":"2f6f853f-9b90-3af6-9d8b-698587104e49","record-reader":"74b2bea2-23cb-32c1-a0b6-ba8f55f30e6d","include-zero-record-flowfiles":"false","dbf-default-scale":"0"},"propertyDescriptors":{"Filtered Results":{"name":"Filtered Results","displayName":"Filtered Results","identifiesControllerService":false,"sensitive":false},"cache-schema":{"name":"cache-schema","displayName":"Cache Schema","identifiesControllerService":false,"sensitive":false},"dbf-default-precision":{"name":"dbf-default-precision","displayName":"Default Decimal Precision","identifiesControllerService":false,"sensitive":false},"record-writer":{"name":"record-writer","displayName":"Record Writer","identifiesControllerService":true,"sensitive":false},"record-reader":{"name":"record-reader","displayName":"Record Reader","identifiesControllerService":true,"sensitive":false},"include-zero-record-flowfiles":{"name":"include-zero-record-flowfiles","displayName":"Include Zero Record FlowFiles","identifiesControllerService":false,"sensitive":false},"dbf-default-scale":{"name":"dbf-default-scale","displayName":"Default Decimal Scale","identifiesControllerService":false,"sensitive":false}},"schedulingPeriod":"0 sec","schedulingStrategy":"TIMER_DRIVEN","executionNode":"ALL","penaltyDuration":"30 sec","yieldDuration":"1 sec","bulletinLevel":"WARN","runDurationMillis":0,"concurrentlySchedulableTaskCount":1,"autoTerminatedRelationships":["original","failure"],"scheduledState":"ENABLED","componentType":"PROCESSOR","groupIdentifier":"c4583d0f-5de7-30c7-978b-be97c8e4605e"},{"identifier":"adb06e77-0f02-34b3-854a-363dde3ff4a2","name":"Set Job Parameters","comments":"","position":{"x":984.0,"y":72.0},"bundle":{"group":"org.apache.nifi","artifact":"nifi-update-attribute-nar","version":"1.15.2.2.1.3.0-125"},"style":{},"type":"org.apache.nifi.processors.attributes.UpdateAttribute","properties":{"Delete Attributes Expression":null,"filename":"recent_bulletins.csv","Store State":"Do not store state","canonical-value-lookup-cache-size":"100","body_header":"Recent Bulletins in #{instance_id}","Stateful Variables Initial Value":null,"excluded.group.names":"'Update Reporting Database'"},"propertyDescriptors":{"Delete Attributes Expression":{"name":"Delete Attributes Expression","displayName":"Delete Attributes Expression","identifiesControllerService":false,"sensitive":false},"filename":{"name":"filename","displayName":"filename","identifiesControllerService":false,"sensitive":false},"Store State":{"name":"Store State","displayName":"Store State","identifiesControllerService":false,"sensitive":false},"canonical-value-lookup-cache-size":{"name":"canonical-value-lookup-cache-size","displayName":"Cache Value Lookup Cache Size","identifiesControllerService":false,"sensitive":false},"body_header":{"name":"body_header","displayName":"body_header","identifiesControllerService":false,"sensitive":false},"Stateful Variables Initial Value":{"name":"Stateful Variables Initial Value","displayName":"Stateful Variables Initial Value","identifiesControllerService":false,"sensitive":false},"excluded.group.names":{"name":"excluded.group.names","displayName":"excluded.group.names","identifiesControllerService":false,"sensitive":false}},"schedulingPeriod":"0 sec","schedulingStrategy":"TIMER_DRIVEN","executionNode":"ALL","penaltyDuration":"30 sec","yieldDuration":"1 sec","bulletinLevel":"WARN","runDurationMillis":0,"concurrentlySchedulableTaskCount":1,"autoTerminatedRelationships":[],"scheduledState":"ENABLED","componentType":"PROCESSOR","groupIdentifier":"c4583d0f-5de7-30c7-978b-be97c8e4605e"},{"identifier":"166d80c6-4fd9-321a-b3f2-72cbdb04466b","name":"Bulletin Summary to Ascii Table","comments":"","position":{"x":984.0,"y":808.0},"bundle":{"group":"org.apache.nifi","artifact":"nifi-groovyx-nar","version":"1.15.2.2.1.3.0-125"},"style":{"background-color":"#ff8189"},"type":"org.apache.nifi.processors.groovyx.ExecuteGroovyScript","properties":{"groovyx-script-body":"// JSON Data to ASCII Table\ndef flowFile = session.get()\nif (!flowFile) { return }\n\ndef jsonSlurper = new groovy.json.JsonSlurper()\ndef headers\ndef data\n\n// Used to ensure the object is an array\ndef arrayfy = { [] + it ?: [it] };\n\n// Set property SOURCE_JSON to a JSON string if you want to parse from there\n// instead of from the flowfile contents\nif (binding.hasVariable('SOURCE_JSON')) {\n def jsonText = SOURCE_JSON.evaluateAttributeExpressions(flowFile).value\n if (!jsonText?.trim() || jsonText == '[]') {\n REL_SUCCESS << flowFile\n return\n }\n data = jsonSlurper.parseText(jsonText)\n data = arrayfy(data)\n} else {\n def inputStream = session.read(flowFile)\n data = jsonSlurper.parse(inputStream)\n data = arrayfy(data)\n}\n\n// Set property HEADER_LIST to a comma-separated list of headers\n// If not set, it will use the list of all keys present in the first\n// record parsed above\nif (binding.hasVariable('HEADER_LIST')) {\n headers = HEADER_LIST.evaluateAttributeExpressions(flowFile).value.split(',')\n} else {\n headers = data[0].keySet()\n}\n\n// Convert the data array into an ascii table using the given list\n// of properties as the headers\n// Trims all data and replaces newlines with spaces\n/* groovylint-disable-next-line MethodParameterTypeRequired */\nString dataToTable(headers, data) {\n // Calculate the max width of each column\n def columnWidths = [:]\n headers.each { columnWidths[it] = it.size() }\n data.each { row ->\n headers.each { col ->\n if (row[col] == null) { row[col] = '' }\n row[col] = String.valueOf(row[col]).replaceAll('\\n', ' ').trim()\n columnWidths[col] = Math.max(columnWidths[col], row[col].size()) }\n }\n // TODO: Add support for multi-line data\n // split data above on newlines to determine max length of any given line\n // below, split data on newlines and iterate over lines after the first\n // build the lines after the first with blanks for other columns\n // NOTE: This logic really only works if there is a single column that can be multiline\n def headerRow = '| ' + headers.collect { header -> header.padRight(columnWidths[header] + 1) }.join(' | ') + ' |'\n def separator = '| ' + headers.collect { header -> '-' * (columnWidths[header] + 1) }.join(' | ') + ' |'\n def dataRows = data.collect {\n row -> w = headers.iterator()\n return '| ' + headers.collect {\n col -> String.valueOf(row[col]).padRight(columnWidths[w.next()] + 1)\n }.join(' | ') + ' |'\n };\n\n def output = separator + '\\n' + headerRow + '\\n' + separator + '\\n' + dataRows.join('\\n') + '\\n' + separator\n return output\n}\n\n// Set property RESULT_PROP_NAME to the name of the property to set on the flowfile with the ascii table\n// If the property is not set, the ascii table will be written to the flowfile content\nif (binding.hasVariable('RESULT_PROP_NAME')) {\n flowFile[RESULT_PROP_NAME.evaluateAttributeExpressions(flowFile).value] = dataToTable(headers, data)\n} else {\n flowFile.write('UTF-8', dataToTable(headers, data))\n}\n\nREL_SUCCESS << flowFile\n","groovyx-failure-strategy":"transfer to failure","RESULT_PROP_NAME":"results.text","groovyx-additional-classpath":null,"HEADER_LIST":"Level,Process_Group_Path,Processor_Name,Count","groovyx-script-file":null},"propertyDescriptors":{"groovyx-script-body":{"name":"groovyx-script-body","displayName":"Script Body","identifiesControllerService":false,"sensitive":false},"groovyx-failure-strategy":{"name":"groovyx-failure-strategy","displayName":"Failure strategy","identifiesControllerService":false,"sensitive":false},"RESULT_PROP_NAME":{"name":"RESULT_PROP_NAME","displayName":"RESULT_PROP_NAME","identifiesControllerService":false,"sensitive":false},"groovyx-additional-classpath":{"name":"groovyx-additional-classpath","displayName":"Additional classpath","identifiesControllerService":false,"sensitive":false},"HEADER_LIST":{"name":"HEADER_LIST","displayName":"HEADER_LIST","identifiesControllerService":false,"sensitive":false},"groovyx-script-file":{"name":"groovyx-script-file","displayName":"Script File","identifiesControllerService":false,"sensitive":false,"resourceDefinition":{"cardinality":"SINGLE","resourceTypes":["FILE"]}}},"schedulingPeriod":"0 sec","schedulingStrategy":"TIMER_DRIVEN","executionNode":"ALL","penaltyDuration":"30 sec","yieldDuration":"1 sec","bulletinLevel":"WARN","runDurationMillis":0,"concurrentlySchedulableTaskCount":1,"autoTerminatedRelationships":["failure"],"scheduledState":"ENABLED","componentType":"PROCESSOR","groupIdentifier":"c4583d0f-5de7-30c7-978b-be97c8e4605e"}],"inputPorts":[{"identifier":"401b967d-209a-377c-a0a4-7ad9e178e4e2","name":"Job ID and Recipients","position":{"x":1040.0,"y":-40.0},"type":"INPUT_PORT","concurrentlySchedulableTaskCount":1,"scheduledState":"ENABLED","allowRemoteAccess":false,"componentType":"INPUT_PORT","groupIdentifier":"c4583d0f-5de7-30c7-978b-be97c8e4605e"}],"outputPorts":[{"identifier":"3eb3faa2-ffe1-3bbc-b186-d2bbc3ff2808","name":"Bulletin Summary and Attachment","position":{"x":1040.0,"y":1384.0},"type":"OUTPUT_PORT","concurrentlySchedulableTaskCount":1,"scheduledState":"ENABLED","allowRemoteAccess":false,"componentType":"OUTPUT_PORT","groupIdentifier":"c4583d0f-5de7-30c7-978b-be97c8e4605e"}],"connections":[{"identifier":"ecf0843c-d17b-317a-82a2-bb39f7ab61c0","name":"","source":{"id":"0368b198-e5c7-3b28-bd82-d104eae149bb","type":"PROCESSOR","groupId":"c4583d0f-5de7-30c7-978b-be97c8e4605e","name":"Filter by Recipient","comments":""},"destination":{"id":"3eb3faa2-ffe1-3bbc-b186-d2bbc3ff2808","type":"OUTPUT_PORT","groupId":"c4583d0f-5de7-30c7-978b-be97c8e4605e","name":"Bulletin Summary and Attachment"},"labelIndex":1,"zIndex":0,"selectedRelationships":["Filtered Results"],"backPressureObjectThreshold":10000,"backPressureDataSizeThreshold":"1 GB","flowFileExpiration":"0 sec","prioritizers":[],"bends":[],"loadBalanceStrategy":"DO_NOT_LOAD_BALANCE","partitioningAttribute":"","loadBalanceCompression":"DO_NOT_COMPRESS","componentType":"CONNECTION","groupIdentifier":"c4583d0f-5de7-30c7-978b-be97c8e4605e"},{"identifier":"adebcd52-fae4-35d4-b06c-c0c331b35434","name":"","source":{"id":"1b17589c-02d4-3bab-9d3b-3bf6c7e446a4","type":"PROCESSOR","groupId":"c4583d0f-5de7-30c7-978b-be97c8e4605e","name":"Get Recent Bulletin Summary","comments":""},"destination":{"id":"ea070129-c96d-31ad-b107-03c85c5be935","type":"PROCESSOR","groupId":"c4583d0f-5de7-30c7-978b-be97c8e4605e","name":"Split by Potential Recipients","comments":""},"labelIndex":1,"zIndex":0,"selectedRelationships":["success"],"backPressureObjectThreshold":10000,"backPressureDataSizeThreshold":"1 GB","flowFileExpiration":"0 sec","prioritizers":[],"bends":[],"loadBalanceStrategy":"DO_NOT_LOAD_BALANCE","partitioningAttribute":"","loadBalanceCompression":"DO_NOT_COMPRESS","componentType":"CONNECTION","groupIdentifier":"c4583d0f-5de7-30c7-978b-be97c8e4605e"},{"identifier":"d251df64-c78c-3409-997c-d37e7e145873","name":"","source":{"id":"adb06e77-0f02-34b3-854a-363dde3ff4a2","type":"PROCESSOR","groupId":"c4583d0f-5de7-30c7-978b-be97c8e4605e","name":"Set Job Parameters","comments":""},"destination":{"id":"1b17589c-02d4-3bab-9d3b-3bf6c7e446a4","type":"PROCESSOR","groupId":"c4583d0f-5de7-30c7-978b-be97c8e4605e","name":"Get Recent Bulletin Summary","comments":""},"labelIndex":1,"zIndex":0,"selectedRelationships":["success"],"backPressureObjectThreshold":10000,"backPressureDataSizeThreshold":"1 GB","flowFileExpiration":"0 sec","prioritizers":[],"bends":[],"loadBalanceStrategy":"DO_NOT_LOAD_BALANCE","partitioningAttribute":"","loadBalanceCompression":"DO_NOT_COMPRESS","componentType":"CONNECTION","groupIdentifier":"c4583d0f-5de7-30c7-978b-be97c8e4605e"},{"identifier":"4568c1e2-0141-392e-9709-e00373acc979","name":"","source":{"id":"ea070129-c96d-31ad-b107-03c85c5be935","type":"PROCESSOR","groupId":"c4583d0f-5de7-30c7-978b-be97c8e4605e","name":"Split by Potential Recipients","comments":""},"destination":{"id":"b3fd08a6-549a-3b1b-9f0f-c0133ff733d5","type":"PROCESSOR","groupId":"c4583d0f-5de7-30c7-978b-be97c8e4605e","name":"Filter by Recipient and Drop Empty","comments":""},"labelIndex":1,"zIndex":0,"selectedRelationships":["success"],"backPressureObjectThreshold":10000,"backPressureDataSizeThreshold":"1 GB","flowFileExpiration":"0 sec","prioritizers":[],"bends":[],"loadBalanceStrategy":"DO_NOT_LOAD_BALANCE","partitioningAttribute":"","loadBalanceCompression":"DO_NOT_COMPRESS","componentType":"CONNECTION","groupIdentifier":"c4583d0f-5de7-30c7-978b-be97c8e4605e"},{"identifier":"af2d50af-412c-3064-82f9-eaa5d85d4f08","name":"","source":{"id":"b3fd08a6-549a-3b1b-9f0f-c0133ff733d5","type":"PROCESSOR","groupId":"c4583d0f-5de7-30c7-978b-be97c8e4605e","name":"Filter by Recipient and Drop Empty","comments":""},"destination":{"id":"166d80c6-4fd9-321a-b3f2-72cbdb04466b","type":"PROCESSOR","groupId":"c4583d0f-5de7-30c7-978b-be97c8e4605e","name":"Bulletin Summary to Ascii Table","comments":""},"labelIndex":1,"zIndex":0,"selectedRelationships":["Filtered Results"],"backPressureObjectThreshold":10000,"backPressureDataSizeThreshold":"1 GB","flowFileExpiration":"0 sec","prioritizers":[],"bends":[],"loadBalanceStrategy":"DO_NOT_LOAD_BALANCE","partitioningAttribute":"","loadBalanceCompression":"DO_NOT_COMPRESS","componentType":"CONNECTION","groupIdentifier":"c4583d0f-5de7-30c7-978b-be97c8e4605e"},{"identifier":"f2248b49-23c9-31c8-9c60-929de6b7fce6","name":"","source":{"id":"166d80c6-4fd9-321a-b3f2-72cbdb04466b","type":"PROCESSOR","groupId":"c4583d0f-5de7-30c7-978b-be97c8e4605e","name":"Bulletin Summary to Ascii Table","comments":""},"destination":{"id":"b9b05efe-5307-33c1-870f-14b74c7bc3bb","type":"PROCESSOR","groupId":"c4583d0f-5de7-30c7-978b-be97c8e4605e","name":"Get Bulletin Details","comments":""},"labelIndex":1,"zIndex":0,"selectedRelationships":["success"],"backPressureObjectThreshold":10000,"backPressureDataSizeThreshold":"1 GB","flowFileExpiration":"0 sec","prioritizers":[],"bends":[],"loadBalanceStrategy":"DO_NOT_LOAD_BALANCE","partitioningAttribute":"","loadBalanceCompression":"DO_NOT_COMPRESS","componentType":"CONNECTION","groupIdentifier":"c4583d0f-5de7-30c7-978b-be97c8e4605e"},{"identifier":"48312179-2b96-36d0-94d1-9ed668b42ed0","name":"","source":{"id":"b9b05efe-5307-33c1-870f-14b74c7bc3bb","type":"PROCESSOR","groupId":"c4583d0f-5de7-30c7-978b-be97c8e4605e","name":"Get Bulletin Details","comments":""},"destination":{"id":"0368b198-e5c7-3b28-bd82-d104eae149bb","type":"PROCESSOR","groupId":"c4583d0f-5de7-30c7-978b-be97c8e4605e","name":"Filter by Recipient","comments":""},"labelIndex":1,"zIndex":0,"selectedRelationships":["success"],"backPressureObjectThreshold":10000,"backPressureDataSizeThreshold":"1 GB","flowFileExpiration":"0 sec","prioritizers":[],"bends":[],"loadBalanceStrategy":"DO_NOT_LOAD_BALANCE","partitioningAttribute":"","loadBalanceCompression":"DO_NOT_COMPRESS","componentType":"CONNECTION","groupIdentifier":"c4583d0f-5de7-30c7-978b-be97c8e4605e"},{"identifier":"306b769d-3dbd-3266-8f5e-c5f873e818fe","name":"","source":{"id":"401b967d-209a-377c-a0a4-7ad9e178e4e2","type":"INPUT_PORT","groupId":"c4583d0f-5de7-30c7-978b-be97c8e4605e","name":"Job ID and Recipients"},"destination":{"id":"adb06e77-0f02-34b3-854a-363dde3ff4a2","type":"PROCESSOR","groupId":"c4583d0f-5de7-30c7-978b-be97c8e4605e","name":"Set Job Parameters","comments":""},"labelIndex":1,"zIndex":0,"selectedRelationships":[""],"backPressureObjectThreshold":10000,"backPressureDataSizeThreshold":"1 GB","flowFileExpiration":"0 sec","prioritizers":[],"bends":[],"loadBalanceStrategy":"DO_NOT_LOAD_BALANCE","partitioningAttribute":"","loadBalanceCompression":"DO_NOT_COMPRESS","componentType":"CONNECTION","groupIdentifier":"c4583d0f-5de7-30c7-978b-be97c8e4605e"}],"labels":[{"identifier":"27db6680-4d76-3f27-a413-77cf108c7052","position":{"x":136.0,"y":176.0},"label":"SELECT \n bulletinlevel AS \"Level\"\n, SUBSTRING(bulletingrouppath, '[^/]+ / (.*)') as \"Process_Group_Path\"\n, bulletinsourcename AS \"Processor_Name\"\n, COUNT(*) as \"Count\"\n, filter_where_clause\n, notification_to\nFROM #{monitoring_schema}.monitoring_bulletins\nCROSS JOIN (\nSELECT filter_where_clause, notification_to, notification_cc from #{monitoring_schema}.notification_filters WHERE notification_type = '${bulletin_job_type}'\nUNION ALL\nSELECT '/* ALL */' AS filter_where_clause, '${to_recipient}' AS notification_to, '${cc_recipient}' AS notification_cc\n) f\nWHERE bulletincategory = 'Log Message'\n --AND to_timestamp(bulletintimestamp/1000) > DATE(NOW())\n AND bulletintimestamp >= ${start.ts}::bigint * 1000\n AND bulletintimestamp <= ${end.ts}::bigint * 1000\n AND bulletingroupname NOT IN ( ${excluded.group.names} )\nGROUP BY bulletinlevel, bulletingrouppath, bulletinsourcename, filter_where_clause, notification_to\nORDER BY filter_where_clause, notification_to, \"Process_Group_Path\", \"Processor_Name\"","width":840.0,"height":296.0,"style":{"font-size":"12px"},"componentType":"LABEL","groupIdentifier":"c4583d0f-5de7-30c7-978b-be97c8e4605e"},{"identifier":"2cd40b85-1a32-38ba-b392-053663aebae6","position":{"x":1344.0,"y":624.0},"label":"SELECT * FROM FLOWFILE\n${filter_where_clause}","width":256.0,"height":40.0,"style":{"font-size":"12px"},"componentType":"LABEL","groupIdentifier":"c4583d0f-5de7-30c7-978b-be97c8e4605e"},{"identifier":"949ae549-9e5f-3c73-b7e3-183be4a0eed3","position":{"x":240.0,"y":952.0},"label":"SELECT \n to_char(to_timestamp(bulletintimestamp/1000) AT TIME ZONE 'America/Los_Angeles', 'YYYY-MM-DD HH24:MI:SS') AS \"Bulletin_Time\"\n, bulletinlevel AS \"Level\"\n, SUBSTRING(bulletingrouppath, '[^/]+ / (.*)') AS \"Process_Group_Path\"\n, bulletinsourcename AS \"Processor_Name\"\n, bulletinmessage AS \"Message\"\nFROM #{monitoring_schema}.monitoring_bulletins\nWHERE bulletincategory = 'Log Message'\n --AND to_timestamp(bulletintimestamp/1000) > DATE(NOW())\n AND bulletintimestamp >= ${start.ts}::bigint * 1000\n AND bulletintimestamp <= ${end.ts}::bigint * 1000\n AND bulletingroupname NOT IN ( ${excluded.group.names} )\nORDER BY \"Process_Group_Path\", \"Processor_Name\", \"Bulletin_Time\"\nLIMIT 500","width":736.0,"height":208.0,"style":{"font-size":"12px"},"componentType":"LABEL","groupIdentifier":"c4583d0f-5de7-30c7-978b-be97c8e4605e"},{"identifier":"8135f99f-de4e-3157-932d-1c9a8592a638","position":{"x":1344.0,"y":1176.0},"label":"SELECT * FROM FLOWFILE\n${filter_where_clause}","width":256.0,"height":40.0,"style":{"font-size":"12px"},"componentType":"LABEL","groupIdentifier":"c4583d0f-5de7-30c7-978b-be97c8e4605e"}],"funnels":[],"controllerServices":[],"variables":{},"defaultFlowFileExpiration":"0 sec","defaultBackPressureObjectThreshold":10000,"defaultBackPressureDataSizeThreshold":"1 GB","componentType":"PROCESS_GROUP","flowFileConcurrency":"UNBOUNDED","flowFileOutboundPolicy":"STREAM_WHEN_AVAILABLE","groupIdentifier":"afb46297-767d-303f-901d-99bcdb04821c"}],"remoteProcessGroups":[],"processors":[{"identifier":"b75c17a8-5a34-31e6-8846-dedbc597c394","name":"CRON: Set Start Date and Recipients","comments":"","position":{"x":1960.4965512309457,"y":-304.3151147493372},"bundle":{"group":"org.apache.nifi","artifact":"nifi-standard-nar","version":"1.15.2.2.1.3.0-125"},"style":{"background-color":"#000000"},"type":"org.apache.nifi.processors.standard.GenerateFlowFile","properties":{"character-set":"UTF-8","subject_line":"NiFi Bulletins (since ${now():toNumber():minus(3600000):toDate():format(\"HH:mm\", \"America/Los_Angeles\")})","mime-type":"text/csv","end.ts":"${now():toNumber():divide(1000)}","File Size":"0B","generate-ff-custom-text":null,"bulletin_job_type":"Bulletins-Hourly","Batch Size":"1","start.ts":"${now():toNumber():minus(3600000):divide(1000)}","Unique FlowFiles":"false","cc_recipient":"","Data Format":"Text","to_recipient":"#{bulletin_hourly_email_to}"},"propertyDescriptors":{"character-set":{"name":"character-set","displayName":"Character Set","identifiesControllerService":false,"sensitive":false},"subject_line":{"name":"subject_line","displayName":"subject_line","identifiesControllerService":false,"sensitive":false},"mime-type":{"name":"mime-type","displayName":"Mime Type","identifiesControllerService":false,"sensitive":false},"end.ts":{"name":"end.ts","displayName":"end.ts","identifiesControllerService":false,"sensitive":false},"File Size":{"name":"File Size","displayName":"File Size","identifiesControllerService":false,"sensitive":false},"generate-ff-custom-text":{"name":"generate-ff-custom-text","displayName":"Custom Text","identifiesControllerService":false,"sensitive":false},"bulletin_job_type":{"name":"bulletin_job_type","displayName":"bulletin_job_type","identifiesControllerService":false,"sensitive":false},"Batch Size":{"name":"Batch Size","displayName":"Batch Size","identifiesControllerService":false,"sensitive":false},"start.ts":{"name":"start.ts","displayName":"start.ts","identifiesControllerService":false,"sensitive":false},"Unique FlowFiles":{"name":"Unique FlowFiles","displayName":"Unique FlowFiles","identifiesControllerService":false,"sensitive":false},"cc_recipient":{"name":"cc_recipient","displayName":"cc_recipient","identifiesControllerService":false,"sensitive":false},"Data Format":{"name":"Data Format","displayName":"Data Format","identifiesControllerService":false,"sensitive":false},"to_recipient":{"name":"to_recipient","displayName":"to_recipient","identifiesControllerService":false,"sensitive":false}},"schedulingPeriod":"0 5 * * * ?","schedulingStrategy":"CRON_DRIVEN","executionNode":"PRIMARY","penaltyDuration":"30 sec","yieldDuration":"1 sec","bulletinLevel":"WARN","runDurationMillis":0,"concurrentlySchedulableTaskCount":1,"autoTerminatedRelationships":[],"scheduledState":"ENABLED","componentType":"PROCESSOR","groupIdentifier":"afb46297-767d-303f-901d-99bcdb04821c"},{"identifier":"a5b887aa-a46a-35b5-8451-c30312a466e4","name":"Send Bulletin Email","comments":"","position":{"x":1960.4965512309457,"y":135.68488525066277},"bundle":{"group":"org.apache.nifi","artifact":"nifi-standard-nar","version":"1.15.2.2.1.3.0-125"},"style":{"background-color":"#c6007e"},"type":"org.apache.nifi.processors.standard.PutEmail","properties":{"CC":"${notification_cc}","SMTP Socket Factory":"javax.net.ssl.SSLSocketFactory","BCC":null,"Message":"${body_header}\n\n
${results.text}
\n\n\n","Attach File":"true","attribute-name-regex":null,"SMTP Port":"#{SMTP Port}","SMTP Auth":"true","From":"#{SMTP From Address}","Include All Attributes In Message":"false","SMTP Hostname":"#{SMTP Hostname}","Subject":"[#{instance_id}] ${subject_line}","SMTP X-Mailer Header":"NiFi #{instance_id}","Content Type":"text/html","SMTP Username":"#{SMTP Username}","To":"${notification_to}","SMTP Password":"#{SMTP Password}","email-ff-content-as-message":"false","SMTP TLS":"true"},"propertyDescriptors":{"CC":{"name":"CC","displayName":"CC","identifiesControllerService":false,"sensitive":false},"SMTP Socket Factory":{"name":"SMTP Socket Factory","displayName":"SMTP Socket Factory","identifiesControllerService":false,"sensitive":false},"BCC":{"name":"BCC","displayName":"BCC","identifiesControllerService":false,"sensitive":false},"Message":{"name":"Message","displayName":"Message","identifiesControllerService":false,"sensitive":false},"Attach File":{"name":"Attach File","displayName":"Attach File","identifiesControllerService":false,"sensitive":false},"attribute-name-regex":{"name":"attribute-name-regex","displayName":"Attributes to Send as Headers (Regex)","identifiesControllerService":false,"sensitive":false},"SMTP Port":{"name":"SMTP Port","displayName":"SMTP Port","identifiesControllerService":false,"sensitive":false},"SMTP Auth":{"name":"SMTP Auth","displayName":"SMTP Auth","identifiesControllerService":false,"sensitive":false},"From":{"name":"From","displayName":"From","identifiesControllerService":false,"sensitive":false},"Include All Attributes In Message":{"name":"Include All Attributes In Message","displayName":"Include All Attributes In Message","identifiesControllerService":false,"sensitive":false},"SMTP Hostname":{"name":"SMTP Hostname","displayName":"SMTP Hostname","identifiesControllerService":false,"sensitive":false},"Subject":{"name":"Subject","displayName":"Subject","identifiesControllerService":false,"sensitive":false},"SMTP X-Mailer Header":{"name":"SMTP X-Mailer Header","displayName":"SMTP X-Mailer Header","identifiesControllerService":false,"sensitive":false},"Content Type":{"name":"Content Type","displayName":"Content Type","identifiesControllerService":false,"sensitive":false},"SMTP Username":{"name":"SMTP Username","displayName":"SMTP Username","identifiesControllerService":false,"sensitive":false},"To":{"name":"To","displayName":"To","identifiesControllerService":false,"sensitive":false},"SMTP Password":{"name":"SMTP Password","displayName":"SMTP Password","identifiesControllerService":false,"sensitive":true},"email-ff-content-as-message":{"name":"email-ff-content-as-message","displayName":"Flow file content as message","identifiesControllerService":false,"sensitive":false},"SMTP TLS":{"name":"SMTP TLS","displayName":"SMTP STARTTLS","identifiesControllerService":false,"sensitive":false}},"schedulingPeriod":"0 sec","schedulingStrategy":"TIMER_DRIVEN","executionNode":"ALL","penaltyDuration":"30 sec","yieldDuration":"1 sec","bulletinLevel":"WARN","runDurationMillis":0,"concurrentlySchedulableTaskCount":1,"autoTerminatedRelationships":["success","failure"],"scheduledState":"ENABLED","componentType":"PROCESSOR","groupIdentifier":"afb46297-767d-303f-901d-99bcdb04821c"}],"inputPorts":[],"outputPorts":[],"connections":[{"identifier":"baa1ea4e-d0ea-34d4-9fcc-8f2579ab8c95","name":"","source":{"id":"b75c17a8-5a34-31e6-8846-dedbc597c394","type":"PROCESSOR","groupId":"afb46297-767d-303f-901d-99bcdb04821c","name":"CRON: Set Start Date and Recipients","comments":""},"destination":{"id":"401b967d-209a-377c-a0a4-7ad9e178e4e2","type":"INPUT_PORT","groupId":"c4583d0f-5de7-30c7-978b-be97c8e4605e","name":"Job ID and Recipients"},"labelIndex":1,"zIndex":0,"selectedRelationships":["success"],"backPressureObjectThreshold":10000,"backPressureDataSizeThreshold":"1 GB","flowFileExpiration":"0 sec","prioritizers":[],"bends":[],"loadBalanceStrategy":"DO_NOT_LOAD_BALANCE","partitioningAttribute":"","loadBalanceCompression":"DO_NOT_COMPRESS","componentType":"CONNECTION","groupIdentifier":"afb46297-767d-303f-901d-99bcdb04821c"},{"identifier":"1d68a8eb-c417-3fed-bd3c-4a93bbd0da4e","name":"","source":{"id":"3eb3faa2-ffe1-3bbc-b186-d2bbc3ff2808","type":"OUTPUT_PORT","groupId":"c4583d0f-5de7-30c7-978b-be97c8e4605e","name":"Bulletin Summary and Attachment"},"destination":{"id":"a5b887aa-a46a-35b5-8451-c30312a466e4","type":"PROCESSOR","groupId":"afb46297-767d-303f-901d-99bcdb04821c","name":"Send Bulletin Email","comments":""},"labelIndex":1,"zIndex":0,"selectedRelationships":[""],"backPressureObjectThreshold":10000,"backPressureDataSizeThreshold":"1 GB","flowFileExpiration":"0 sec","prioritizers":[],"bends":[],"loadBalanceStrategy":"DO_NOT_LOAD_BALANCE","partitioningAttribute":"","loadBalanceCompression":"DO_NOT_COMPRESS","componentType":"CONNECTION","groupIdentifier":"afb46297-767d-303f-901d-99bcdb04821c"}],"labels":[{"identifier":"a028c3a9-f737-38b2-9fce-235ac873215f","position":{"x":1960.4965512309457,"y":-344.3151147493372},"label":"Hourly: x:05","width":352.0,"height":40.0,"style":{"background-color":"#000000","font-size":"24px"},"componentType":"LABEL","groupIdentifier":"afb46297-767d-303f-901d-99bcdb04821c"},{"identifier":"7ac1c241-1712-3d62-a428-b8241e2c5738","position":{"x":1536.0,"y":-272.0},"label":"CREATE TABLE monitoring.monitoring_bulletins ( \n bulletinid \tbigint NOT NULL,\n bulletincategory \tvarchar(40) NULL,\n bulletingroupid \tvarchar(40) NULL,\n bulletingroupname \tvarchar(240) NULL,\n bulletingrouppath \tvarchar(2000) NULL,\n bulletinlevel \tvarchar(10) NULL,\n bulletinmessage \ttext NULL,\n bulletinnodeaddress \tvarchar(100) NULL,\n bulletinnodeid \tvarchar(40) NULL,\n bulletinsourceid \tvarchar(40) NULL,\n bulletinsourcename \tvarchar(100) NULL,\n bulletinsourcetype \tvarchar(20) NULL,\n bulletintimestamp \tbigint NULL,\n bulletinflowfileuuid\tvarchar(40) NULL,\n PRIMARY KEY(bulletinid)\n)\n/\nCREATE TABLE monitoring.notification_filters ( \n notification_type \tvarchar(30) NULL,\n filter_where_clause\tvarchar(1000) NULL,\n notification_to \tvarchar(100) NULL,\n notification_cc \tvarchar(100) NULL \n )\n/\n","width":392.0,"height":384.0,"style":{"font-size":"12px"},"componentType":"LABEL","groupIdentifier":"afb46297-767d-303f-901d-99bcdb04821c"}],"funnels":[],"controllerServices":[],"variables":{},"defaultFlowFileExpiration":"0 sec","defaultBackPressureObjectThreshold":10000,"defaultBackPressureDataSizeThreshold":"1 GB","componentType":"PROCESS_GROUP","flowFileConcurrency":"UNBOUNDED","flowFileOutboundPolicy":"STREAM_WHEN_AVAILABLE"},"externalControllerServices":{"74b2bea2-23cb-32c1-a0b6-ba8f55f30e6d":{"identifier":"74b2bea2-23cb-32c1-a0b6-ba8f55f30e6d","name":"Reader - JSON - Infer Schema"},"a6e11450-5e14-3476-867b-eaba7786a8f6":{"identifier":"a6e11450-5e14-3476-867b-eaba7786a8f6","name":"Reader - CSV-Unix - Infer Schema"},"2f6f853f-9b90-3af6-9d8b-698587104e49":{"identifier":"2f6f853f-9b90-3af6-9d8b-698587104e49","name":"Writer - JSON Array - Inherit Schema"},"133001f1-109a-3d50-b479-03b37577a57d":{"identifier":"133001f1-109a-3d50-b479-03b37577a57d","name":"DB - Postgres - Integrations"},"5f744dea-a441-345b-9709-f66680f00829":{"identifier":"5f744dea-a441-345b-9709-f66680f00829","name":"Writer - CSV-Unix - Inherit Schema"}},"parameterContexts":{},"flowEncodingVersion":"1.0"}