Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log parser not finding matches #408

Open
akhirsch-gt opened this issue Aug 4, 2016 · 2 comments
Open

Log parser not finding matches #408

akhirsch-gt opened this issue Aug 4, 2016 · 2 comments

Comments

@akhirsch-gt
Copy link

akhirsch-gt commented Aug 4, 2016

I have a log that contains the line " 1 al_new: void" (without quotes). I am trying to parse this log with synoptic, with the option-r '(?<TIME>)\\s*al_new:\\s*.+(?<TYPE=>new)'to try to parse it. However, synoptic keeps telling me the line does not parse. When I put the "processed" output into a java file with regex (?:\\s*(\\S+)\\s*)\\s*al_new:\\s*.+, it does parse!

Moreover, the example on your wiki page does not work: it only processes ^hello as a regex, ignoring everything after the space. It then complains that there is no TYPE or STATE assigned in the regex.

Is it possible to fix this, or to write my own parser and use synoptic as a library?

@bestchai
Copy link
Member

bestchai commented Aug 5, 2016

Thanks for the bug report. I'll look into this issue, but it might take a while.

The quick fix to this is to pre-process your input log using some other text-processing tools, such as awk/sed/perl and then use synoptic on the simpler, post-processed, input log. For example, for the line "1 al_new: void" in your example input, the post-processed log would contain the line "new", which is the TYPE that you'd like synoptic to use (based on your "(?<TYPE=>new)" fragment).

Synoptic can be used as a library, but this is not documented and is fairly involved. If you're interested, take a look at InvariMintSynoptic.java class in the InvariMint project, here:
https://github.com/ModelInference/synoptic/blob/master/InvariMint/src/algorithms/InvariMintSynoptic.java
This class contains an runStdAlg method that runs the synoptic algorithm using synoptic as a library. You'll have to piece together the library usage by tracing this method and this class in the InvariMint codebase. The bulk of the logic is in the PGraphInvariMint class.

@akhirsch-gt
Copy link
Author

After spending some time tracing through your code, I realized (based on seeing how the log printing worked) that the issue was with my command. However, this is partly due to the documentation:

Your wiki uses the example synoptic -r '^hello .+'. However, on Ubuntu 14.04, this is processed as three arguments (without double quotes): "-r", "'^hello", and ".+'". In my case, without the space, I was processing the regex '(?:\\s*(\\S+)\\s*)\\s*al_new:\\s*.+', which didn't match because of the single quotes. If I remove the quotes, then it works.

I'm leaving this open because I still believe that there are two things that should be done: an update to the wiki, and fixing the hello example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants