Skip to content

Instantly share code, notes, and snippets.

@prakashmishra1598
prakashmishra1598 / ingest_pipeline_delay
Created January 15, 2020 05:54 — forked from cdahlqvist/ingest_pipeline_delay
Ingest pipeline definition for measuring ingest delay based on @timestamp field
# 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"
}
@prakashmishra1598
prakashmishra1598 / sample_module.py
Created July 26, 2017 06:58 — forked from juliedavila/sample_module.py
New Ansible Module Boilerplate
#!/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():