Class GrokDataFormat

  • All Implemented Interfaces:
    AutoCloseable, org.apache.camel.CamelContextAware, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.spi.DataFormat, org.apache.camel.spi.DataFormatName, org.apache.camel.StatefulService, org.apache.camel.SuspendableService

    @Dataformat("grok")
    public class GrokDataFormat
    extends org.apache.camel.support.service.ServiceSupport
    implements org.apache.camel.spi.DataFormat, org.apache.camel.spi.DataFormatName, org.apache.camel.CamelContextAware
    • Constructor Detail

      • GrokDataFormat

        public GrokDataFormat​(String pattern)
      • GrokDataFormat

        public GrokDataFormat()
    • Method Detail

      • registerPatternDefinition

        public GrokDataFormat registerPatternDefinition​(String name,
                                                        String pattern)
        Parameters:
        name - : Pattern Name
        pattern - : Regular expression Or Grok pattern
      • setFlattened

        public GrokDataFormat setFlattened​(boolean flattened)
        Sets the flattened mode flag
        Parameters:
        flattened - If true, conversion throws exception for conficting named matches.
      • setAllowMultipleMatchesPerLine

        public GrokDataFormat setAllowMultipleMatchesPerLine​(boolean allowMultipleMatchesPerLine)
      • setNamedOnly

        public GrokDataFormat setNamedOnly​(boolean namedOnly)
        Whether to capture named expressions only or not (i.e. %{IP:ip} but not ${IP})
      • getDataFormatName

        public String getDataFormatName()
        Specified by:
        getDataFormatName in interface org.apache.camel.spi.DataFormatName
      • getCamelContext

        public org.apache.camel.CamelContext getCamelContext()
        Specified by:
        getCamelContext in interface org.apache.camel.CamelContextAware
      • setCamelContext

        public void setCamelContext​(org.apache.camel.CamelContext camelContext)
        Specified by:
        setCamelContext in interface org.apache.camel.CamelContextAware
      • marshal

        public void marshal​(org.apache.camel.Exchange exchange,
                            Object graph,
                            OutputStream stream)
                     throws Exception
        Specified by:
        marshal in interface org.apache.camel.spi.DataFormat
        Throws:
        Exception
      • unmarshal

        public Object unmarshal​(org.apache.camel.Exchange exchange,
                                InputStream stream)
                         throws Exception
        Specified by:
        unmarshal in interface org.apache.camel.spi.DataFormat
        Throws:
        Exception
      • doStart

        protected void doStart()
                        throws Exception
        Overrides:
        doStart in class org.apache.camel.support.service.BaseService
        Throws:
        Exception
      • doStop

        protected void doStop()
                       throws Exception
        Overrides:
        doStop in class org.apache.camel.support.service.BaseService
        Throws:
        Exception