This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ingest pipeline that records the timestamp the event was processed (`@received`) | |
# by the ingest pipeline and calculates the difference in milliseconds compared to | |
# the event timestamp (`@timestamp`). | |
POST _scripts/calculate_ingest_delay | |
{ | |
"script": { | |
"lang": "painless", | |
"source": "SimpleDateFormat sdf = new SimpleDateFormat(\"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\"); ctx.ingest_delay = (sdf.parse(ctx['received']).getTime() - sdf.parse(ctx['@timestamp']).getTime()) / 1000.0" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# libraries you import here, must be present on the target node. | |
import os | |
# You can defined other functions up here to make your code more modular. | |
# These functions will need to be called from main(), either directly or through N number of other functions | |
# that eventually lead back to main() | |
def main(): |