Generating statistics

alabard's Avatar

alabard

26 Aug, 2017 04:54 PM

Ciao!

How are you?

I have created a generator that creates a config.user.php but it looks like if I use JSON.parse and then JSON.stringify , but it is weird, because the config file that looks like JSON, it is encode or something, but JSON removes it.
Do you have an idea I would generate JSON strings that are encoded? Because JSON removes all my escaped data.

Like it needs:
\/var\/log\/nginx\/domain.com-access.log, but it truns into /var/log/nginx/domain.com-access.log.

How can this be fixed?
I doesn't look like valid JSON by specs or I am wrong?

It is hard to create 40 logs, because I do not want to have all in only in acccess.log and errors.log.

So that is my problems.

If you could help I could use it, I would be be very thankful!

Bye,
Patrik

  1. Support Staff 1 Posted by potsky on 26 Aug, 2017 07:03 PM

    potsky's Avatar

    Hi !

    your message is a little bit... not escaped ! Nevermind ;-)

    Why not replacing all slashes / by \/ before saving your configuration file ?

  2. 2 Posted by alabard on 28 Aug, 2017 06:14 PM

    alabard's Avatar

    Hey!
    How are you?
    Ok, thanks so much! But which keys should be added with addslashes, because
    it is not for all of them, right?
    You mind to know?
    Have happy day!
    Ciao!

    *Patrik*
    WWW <https://patrikx3.tk> | GitHub <https://github.com/patrikx3/> | NPM
    <https://www.npmjs.com/~patrikx3> | Corifeus <https://corifeus.tk> | +36 20
    342 8046

  3. 3 Posted by alabard on 01 Sep, 2017 07:21 PM

    alabard's Avatar

    yeah, it is totally just a non JSON setting, only hacking can fix it.
    This is pimpmylog data. Not JSON at all.
    I am hacking.

  4. 4 Posted by alabard on 01 Sep, 2017 07:53 PM

    alabard's Avatar

    Ciao! How are you? I fixed it in a hackish fix, but it would be good if it
    was real JSON for the settings, because totally not JSON.
    Somehow in PHP and some helpers that change that data, but it is not JSON
    and it is very hard to work a hacked settings, when every one uses JSON
    (Owncloud, NextcLoud, phpMyAdmin, Roundcube, etc...)
    I am sure you work a lot, so thanks for so much for you program. I used it
    now and works, it is super good, look, but if the config could be add by
    hand or valid JSON it would be so much good:
    [image: Inline image 1]

    Take care, and thanks again!
    Bye,
    Patrik

    *Patrik*
    WWW <https://patrikx3.tk> | GitHub <https://github.com/patrikx3/> | NPM
    <https://www.npmjs.com/~patrikx3> | Corifeus <https://corifeus.tk> | +36 20
    342 8046

  5. 5 Posted by alabard on 01 Sep, 2017 07:55 PM

    alabard's Avatar

    Ciao! How are you? I fixed it in a hackish fix, but it would be good if it was real JSON for the settings, because totally not JSON.
    Somehow in PHP and some helpers that change that data, but it is not JSON and it is very hard to work a hacked settings, when every one uses JSON (Owncloud, NextcLoud, phpMyAdmin, Roundcube, etc...)
    I am sure you work a lot, so thanks for so much for you program. I used it now and works, it is super good, look, but if the config could be add by hand or valid JSON it would be so much good:

    alt text

    Take care, and thanks again!
    Bye,
    Patrik

  6. Support Staff 6 Posted by potsky on 02 Sep, 2017 05:41 PM

    potsky's Avatar

    Congrat's for finally finding a workaround.

    The problem is that the PHP json_encode function escapes slashes by default. This behavior is described in the json RFC. But it is not mandatory...

    There is an option since PHP 5.4 to disable this behavior in the encode function.

    But if you do not escape slashes, it should not be a problem ? Given that there is no option in json_decode about escaped slashes.

  7. potsky closed this discussion on 02 Sep, 2017 05:41 PM.

  8. alabard re-opened this discussion on 02 Sep, 2017 05:51 PM

  9. 7 Posted by alabard on 02 Sep, 2017 05:51 PM

    alabard's Avatar

    Well, I have never seen slashed JSON, I guess it works with something that is RFC, but I never seen, I could only did it with hand crafted, without JSON, besides I created in NodeJs, since these days I use that. But I am happy it works and I know how to do it in the future...

    The Pimp My Log is awesome, good job!

  10. 8 Posted by alabard on 02 Sep, 2017 05:53 PM

    alabard's Avatar

    Maybe long ago in a far galaxy ... :) :) :)
    Have a good day!
    Ciao!
    Bye!

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac