|
| 1 | +name: LogScale.Flows.Upload |
| 2 | +description: | |
| 3 | + This server side event monitoring artifact waits for new artifacts |
| 4 | + to be collected from endpoints and automatically posts those to a |
| 5 | + LogScale (formerly Humio) ingestion endpoint. |
| 6 | +
|
| 7 | +type: SERVER_EVENT |
| 8 | + |
| 9 | +parameters: |
| 10 | + - name: ingestApiBase |
| 11 | + description: API Base Url for LogScale server |
| 12 | + type: string |
| 13 | + default: https://cloud.community.humio.com/api |
| 14 | + - name: ingestToken |
| 15 | + description: Ingest token for API |
| 16 | + type: string |
| 17 | + - name: tagFields |
| 18 | + description: Comma-separated list of field names to use as tags in the message; Can be renamed with <oldname>=<newname>. |
| 19 | + default: |
| 20 | + type: string |
| 21 | + - name: numThreads |
| 22 | + description: Number of threads to start up to post events |
| 23 | + type: int |
| 24 | + default: 1 |
| 25 | + - name: httpTimeout |
| 26 | + description: Timeout (in seconds) for http connection attempts |
| 27 | + type: int |
| 28 | + default: 10 |
| 29 | + - name: batchingTimeoutMs |
| 30 | + description: Timeout to batch events prior to sending |
| 31 | + type: int |
| 32 | + default: 30000 |
| 33 | + - name: eventBatchSize |
| 34 | + description: Count of events to batch prior to sending |
| 35 | + type: int |
| 36 | + default: 2000 |
| 37 | + - name: statsInterval |
| 38 | + description: Interval to post statistics to log (in seconds, 0 to disable) |
| 39 | + type: int |
| 40 | + default: 600 |
| 41 | + - name: debug |
| 42 | + description: Enable verbose logging |
| 43 | + type: bool |
| 44 | + default: false |
| 45 | + - name: ArtifactNameRegex |
| 46 | + default: . |
| 47 | + type: regex |
| 48 | + description: Only upload these artifacts to elastic |
| 49 | + |
| 50 | +sources: |
| 51 | + - query: | |
| 52 | + LET completions = SELECT * FROM watch_monitoring( |
| 53 | + artifact="System.Flow.Completion") |
| 54 | + WHERE Flow.artifacts_with_results =~ ArtifactNameRegex |
| 55 | +
|
| 56 | + LET documents = SELECT * FROM foreach(row=completions, |
| 57 | + query={ |
| 58 | + SELECT * FROM foreach( |
| 59 | + row=Flow.artifacts_with_results, |
| 60 | + query={ |
| 61 | + SELECT *, _value AS Artifact, |
| 62 | + timestamp(epoch=now()) AS timestamp, |
| 63 | + ClientId, Flow.session_id AS FlowId |
| 64 | + FROM source( |
| 65 | + client_id=ClientId, |
| 66 | + flow_id=Flow.session_id, |
| 67 | + artifact=_value) |
| 68 | + }) |
| 69 | + }) |
| 70 | +
|
| 71 | + SELECT * FROM logscale_upload( |
| 72 | + query=documents, |
| 73 | + apibaseurl=ingestApiBase, |
| 74 | + ingest_token=ingestToken, |
| 75 | + threads=numThreads, |
| 76 | + tag_fields=split(string=tagFields, sep=","), |
| 77 | + batching_timeout_ms=batchingTimeoutMs, |
| 78 | + event_batch_size=eventBatchSize, |
| 79 | + http_timeout=httpTimeout, |
| 80 | + debug=debug, |
| 81 | + stats_interval=statsInterval) |
0 commit comments