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

Grok patterns #26

Open
fredericgoossens opened this issue Mar 5, 2023 · 3 comments
Open

Grok patterns #26

fredericgoossens opened this issue Mar 5, 2023 · 3 comments

Comments

@fredericgoossens
Copy link

Someone who has grok paterns for this so it can be parsed using logstash?

@fredericgoossens
Copy link
Author

Made this one for the ftp service:

'timestamp': '%{TIMESTAMP_ISO8601:timestamp}', 'server': '%{WORD:service}', 'action': '%{WORD:action}', 'data': {'cmd': '%{WORD:cmd}', 'args': %{QUOTEDSTRING:args}}, 'src_ip': '%{IP:src_ip}', 'src_port': '%{NUMBER:src_port}', 'dest_ip': '%{IP:dest_ip}', 'dest_port': '%{NUMBER:dest_port}'

@just5ky
Copy link

just5ky commented Mar 6, 2023

Just FYI,
Logstash has JSON filter plugin which will parse it out

input {
}

filter {
json {
source => "message"
}
}

output {
}

@fredericgoossens
Copy link
Author

fredericgoossens commented Mar 15, 2023

Thanks for letting me know. But what you're suggesting still needs some tuning. I currently have the following logstash filter:

input {
  beats {
    port => 5044
  }
}

filter {
        mutate {
          gsub => [
            "message", "'", '"',
            "message", ": None\b", ": null",
            "message", ": True\b", ": true",
            "message", "\\\\x", "\\\\\\\\x",
            "message", "\\x", "\\\\x",
            "message", "\\x", "\\\\u00"
          ]
        }
    json { source => "message" remove_field => [ "message" ] }
}


output {
  elasticsearch {
    hosts => ["http://localhost:9200"]
    index => "xubuntu-%{[@metadata][version]}"
  }
}

Some logs are not getting parsed correctly
afbeelding

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

2 participants