You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@metron.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/05/08 21:43:04 UTC

[jira] [Commented] (METRON-937) Pycapa - Consume Messages from Begin, End, or Stored Offsets

    [ https://issues.apache.org/jira/browse/METRON-937?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16001597#comment-16001597 ] 

ASF GitHub Bot commented on METRON-937:
---------------------------------------

GitHub user nickwallen opened a pull request:

    https://github.com/apache/incubator-metron/pull/570

    METRON-937 Pycapa Consume Messages from Begin, End, or Stored Offsets

    ## Changes
    
    * I have altered Pycapa so that it can consume messages from either the beginning, end or the previously stored offsets of a topic.  This can be done using the `-o` or `--kafka-offset` flag that can be either `begin`, `end`, or `stored`.  This defaults to `end`.
    * Added additional information when using the `--pretty-print` flag.  It will now show the partition and offset for a packet, both on the producer-side (sending packets to Kafka) or the consumer-side (receiving packets from Kafka).
    
    ## Testing
    
    1. Install Pycapa.
    
    1. Launch a Kafka Broker on your localhost.  For example, using Kafka installed via Brew on my Mac.
    
       ```
       export KAFKA_HOME=/usr/local/Cellar/kafka/0.10.1.1/
       export KAFKA_CONF=$KAFKA_HOME/libexec/config
       zookeeper-server-start $KAFKA_CONF/zookeeper.properties
       kafka-server-start $KAFKA_CONF/server.properties
       ```
    
    1. Produce some packets.  Assumes you're actively using `en0` and Kafka is at `localhost:9092`.  Let it run until it completes and captures 50 packets.
    
        ```
         pycapa --producer \
            --interface en0 \
            --kafka-broker localhost:9092 \
            --kafka-topic pcap \
            --max-packets 50
        ```
    
    1. Run the consumer. The consumer will not consume any packets.  It starts from the end of the topic, by default, and since there are no active producers, there is nothing new to consume.
    
        ```
        pycapa --consumer \
            --kafka-broker localhost:9092 \
            --kafka-topic pcap
            --pretty-print 1
        ```
    
    1. Run the consumer again, but start from the beginning of the topic.  You should be able to consume all 50 packets.
    
        ```
        pycapa --consumer \
            --kafka-broker localhost:9092 \
            --kafka-topic pcap
            --pretty-print 1
            --kafka-offset begin
        ```
    
    
    ## Pull Request Checklist
    
    - [ ] Is there a JIRA ticket associated with this PR? If not one needs to be created at [Metron Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel). 
    - [ ] Does your PR title start with METRON-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
    - [ ] Has your PR been rebased against the latest commit within the target branch (typically master)?
    - [ ] Have you included steps to reproduce the behavior or problem that is being changed or addressed?
    - [ ] Have you included steps or a guide to how the change may be verified and tested manually?
    - [ ] Have you ensured that the full suite of tests and checks have been executed in the root incubating-metron folder via:
    - [ ] Have you written or updated unit tests and or integration tests to verify your changes?
    - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? 
    - [ ] Have you verified the basic functionality of the build by building and running locally with Vagrant full-dev environment or the equivalent?
    - [ ] Have you ensured that format looks appropriate for the output in which it is rendered by building and verifying the site-book? If not then run the following commands and the verify changes via `site-book/target/site/index.html`:
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/nickwallen/incubator-metron METRON-937

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-metron/pull/570.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #570
    
----

----


> Pycapa - Consume Messages from Begin, End, or Stored Offsets
> ------------------------------------------------------------
>
>                 Key: METRON-937
>                 URL: https://issues.apache.org/jira/browse/METRON-937
>             Project: Metron
>          Issue Type: Improvement
>            Reporter: Nick Allen
>            Assignee: Nick Allen
>
> Enable Pycapa to consume packets from either the beginning, ending or stored offsets for a topic.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)