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

Add support for grok patterns #39

Open
iilyak opened this issue Jul 7, 2017 · 2 comments
Open

Add support for grok patterns #39

iilyak opened this issue Jul 7, 2017 · 2 comments

Comments

@iilyak
Copy link

iilyak commented Jul 7, 2017

Alfred is a great tool. Thank you for developing it.

This is not an issue but a feature request
It would be really nice to add automatic parsing of an output of a job and store the parsed groups in the variables.
The idea is inspired by filebit

With this feature it would be possible to specify something like (using logstash grok):

node.ps:
  summary: Return list of processes on remote node
  register: node.ps
  command: |
    ssh {{ index .Args 0 }} ps -elf
  ok: node.ps.ok
  fail: node.ps.fail
  grok:
    ssh_error: "ssh: (?<ERROR>[^\,]*)"
    process: "%{F} %{S} %{UID}        %{PID}  %{PPID}  %{C} %{PRI}  %{NI} %{ADDR} %{SZ} %{WCHAN  STIME} %{TTY}          %{TIME} %{CMD}"

node.ps.ok:
  register: node.ps.ok
  command:
    echo '{{ index .Vars "node.ps[*][CMD]" }}'  ### <<--- NOT sure about exact syntax here
  private: true

node.ps.fail:
   
   tasks: node.ping

There are plenty logstash grok patterns here
https://github.com/logstash-plugins/logstash-patterns-core/blob/master/patterns/

There are few grok engines written in go already.

@kcmerrill
Copy link
Owner

The idea being, grok would look for specific file patters and pass/fail depending if it found it or not?

@khia
Copy link

khia commented Jul 9, 2017

The idea would be to match the output of the command (stdout) against grok pattern. Extract named groups and bind them to the variables, so the parsed results would be available for ok/fail commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants