Ask a question

479 questions

598 answers

756 comments

448 members

Ask a question
0 votes
57 views
asked in Networking by

Hi,

I would like to get some logs from the event log from json-rpc, I'm able to get the full log with

eventslog -p -t EVENTS

my problem is I only want some part of it, i.e: SMS (to check an SMS as been sent), so in my logs, I've the line

24|1544016560|SMS|SMS was sent to +XXXXXXXXXX

from the help of eventslog, I see

  -t, --table                   <table> tables (CONNECTIONS, EVENTS, ALL)
  -q, --query                   <query>
...
  -n, --type                    <type> event type
  -e, --text                    <text> event text

So, I expect something like

eventslog -p -t EVENTS -q -n SMS

or

eventslog -p -t EVENTS -q NAME=SMS

could do it, but nothing is output, how this command is working ?

PS: if there is a better way to do that with json-rpc, tell it, please.

1 Answer

0 votes
answered by

Hi, Nicolas,

Try to use this command.

eventslog -p -t EVENTS | grep "|SMS|"

commented by

Hello,

Thx for your answer but it does not seems to work the way I expected.

By doing the json-rpc call without the grep, I have no result (or, to be precise, I've a result, but not the output from the command):

{ "jsonrpc": "2.0", "id": 1, "method": "call", "params": [ "32db4317b6559122de0a43bd9b082958", "file", "exec", { "command":  "eventslog", "params": ["-p", "-t", "EVENTS"] } ] }

This gives me :

{
"jsonrpc": "2.0",
"id": 1,
"result": [
  0,
  {
   "code": 0
  }
]
}

And, even if this was working, I wonder how to pass the second command ("pipe" and grep)

{ "jsonrpc": "2.0", "id": 1, "method": "call", "params": [ "c3c0f060994fc8307897e154d81048c9", "file", "exec", { "command":  "eventslog", "params": ["-p", "-t", "EVENTS", "|", "grep", "|SMS|"] } ] }

This gives me the same:

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": [
        0,
        {
            "code": 0
        }
    ]
}

Thx a lot

commented ago by

Hello,

You can use this command to filter eventslog:

eventslog -p -t EVENTS -d 1 -q " WHERE NAME = 'SMS'"

But we found an issue  wth JSON and RND team is working to fix.