Skip to content

Parser Getting Started

In this chapter we will ship a new punch parser using the maven toolkit, and deploy it as part of a channel. You need maven and java installed on your laptop.

You also need access to the tahles inner source gitlab. Checkout the https://gitlab.thalesdigital.io/punch/parsers area and start installing the parser maven artefact project.

Once done, somewhere adequate for development, execute the following command:

mvn archetype:generate \
    -DarchetypeGroupId=org.thales.punch \
    -DarchetypeArtifactId=parser \
    -DarchetypeVersion=1.0.0 \
    -DgroupId=com.mycompany \
    -DartifactId=myparser
Select the default answer. That generates a new folder with a sample punch parser inside. To compile test and install that parser simply go to tha folder:

cd myparser
and
mvn install
You now have a puch parser in your local maven repository. Check it:
ls ~/.m2/repository/com/mycompany/myparser/1.0-SNAPSHOT/myparser-1.0-SNAPSHOT.zip

Have now a look at the myparser channel. That parser indicates it needs the myparser-1.0-SNAPSHOT package and refer to the enrich.punch and resource files provided by that package.

You should be able to start that parser. The simplest is to use the foreground command:

punchlinectl punchline.yaml
````
Use the injector file to try it: 
```sh
punchplatform-log-injector.sh injector.json