-
Notifications
You must be signed in to change notification settings - Fork 505
METRON-235 Expose filtering capability for PCAP via CLI tool #156
Conversation
| public Options buildOptions() { | ||
| Options options = new Options(); | ||
| options.addOption(newOption("h", false, "Display help")); | ||
| options.addOption(newOption("basePath", true, String.format("Base PCAP data path. Default is '%s'", CliConfig.BASE_PATH_DEFAULT))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a short option as well as a long option? All of the other CLI programs use both, so we should conform.
|
Overall outside of the things I mentioned, this looks really great. Solid contribution @mmiklavc. The only other thing that I would add is to please document this as part of the README.md in pcap-backend A simple description and the possible options for the CLI in both modes would be sufficient. |
|
|
||
| private Options buildFixedOptions() { | ||
| Options options = buildOptions(); | ||
| options.addOption(newOption("srcAddr", true, "Source IP address")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we conform to the naming convention around src/dst addr/port and change:
srcAddrtoip_src_addras the long optiondstAddrtoip_dst_addras the long optionsrcPorttoip_src_portas the long optiondstPorttoip_dst_portas the long option
|
I agree with Casey. We need more docs on the CLI. What can I query for? Which commands should I run to validate this? |
| public void runs_fixed_pcap_filter_job_with_default_argument_list() throws Exception { | ||
| String[] args = { | ||
| "fixed", | ||
| "-start_time", "500", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought these were long args now, how does - work as opposed to --?
|
+1 from me |
|
+1, looks good! |
In the process of testing with Vagrant, but wanted to get this in front of people for review.
Relevant Jira:
https://issues.apache.org/jira/browse/METRON-235
In the process of upgrading to Kibana 4, we lost our about to query/filter pcap results. This PR exposes the 2 methods for filtering PCAP data, fixed parameters and the "Stellar" query language, via a command line tool. The tool is executed via ${metron_home}/bin/pcap_query.sh
Note: I also tweaked the mem settings for Ambari mapreduce to get around persistent OOM errors - mapreduce container sizes (mapreduce.[map | reduce].memory.mb) have been increased to 1.2 GiB, mapreduce.[map | reduce].java.opts have been increased to 1 GiB.
PR Testing Instructions:
Get PCAP data into Metron: Install and setup pycapa - the instructions below reference/mirror those in PR-93
$ cd /opt/pycapa/pycapa && pip install -r requirements.txt && python setup.py installFixed filter
/usr/metron/0.1BETA/bin/pcap_query.sh fixed -st <start_time> -df "yyyyMMdd" -sa <address> -da <address> -sp <port> -dp <port> -p <protocol_num>Query filter
/usr/metron/0.1BETA/bin/pcap_query.sh query -st "20160617" -df "yyyyMMdd" -query "ip_src_addr == '192.168.1.1' and ip_src_port == '49197' and ip_dst_addr == '192.168.1.2' and ip_dst_port == '80' and protocol == '6'"References: