GithubHelp home page GithubHelp logo

Comments (2)

nielsbasjes avatar nielsbasjes commented on June 13, 2024

Please specify the logformat and what goes wrong in the mentioned logline. I currently do not see how matching beyond the end of the line can make a difference?

from logparser.

nielsbasjes avatar nielsbasjes commented on June 13, 2024

I had a good look at your log line and to me it seems like the 'combined' logformat with two extra numbers directly after the time field (I'm guessing something like %B and %D).
I did a quick test with this logformat:

%h %l %u %t %B %D "%r" %>s %b "%{Referer}i" "%{User-Agent}i"

The result is the system parses this completely fine:

    public class Record extends HashMap<String, String> {
        @Override
        public String put(String key, String value) {
            return super.put(key, value);
        }
    }

    @Test
    public void testReportedProblem() throws Exception {
        String line = "1.1.1.1 - - [31/Jul/2016:03:07:00 -0500] 4679405 4 \"GET /admin/cc_info.php?done=1&mv_action=done&_r=106 HTTP/1.1\" 200 2618 \"https://example.com/admin/cc_info.php?done=1&mv_action=done&_r=106\" \"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36\"";
        String format = "%h %l %u %t %B %D \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"";

        String[] params = {
            "STRING:request.firstline.uri.query.done",
            "STRING:request.firstline.uri.query.mv_action",
            "STRING:request.firstline.uri.query._r",
        };

        Parser<Record> parser = new ApacheHttpdLoglineParser<>(Record.class, format);
        parser.addParseTarget(Record.class.getMethod("put", String.class, String.class), Arrays.asList(params));

        Map<String, String> values = parser.parse(new Record(), line);
        System.out.println(values);
    }

I'm closing this for now because I cannot reproduce it.

from logparser.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.