I am trying to replicate the curl method mentioned in splunk rest api doc into R to perform search using R. Sorry, I won't be able provides details on the parameters to replicate. Hence attaching the link for reference.
curl -u admin:changeme -k https://localhost:8089/services/search/jobs -d search="search *"
This returns me a sid from curl. However when I try to replicate the same in R using httr it returns list of all search details. I have tried using both POST & GET in httr just in case. Below is sample code. Ideally below one should return me a sid. however it returns list of existing search details. Not sure what I am missing. I am new to Rcurl,httr. I tried curlperform as well, there also same. Seems, something is missing out. What exactly -d does in curl, is this the thing I am missing to replicate ?
response <- GET(splunk_server,path=search_job_export_endpoint,
config(ssl_verifyhost=FALSE, ssl_verifypeer=0),
authenticate(username, password),
query=list(search=urlencode(search_terms)),
verbose())
result <- read.table(text=content(response, as="text"), sep=",", header=TRUE,
stringsAsFactors=FALSE)
Related
I am trying to automate a json export with cURL. I am following their directions found here
I am following their directions in step 1 and using this request to start an export
curl -X POST 'https://trello.com/1/organizations/{organizationNameOrId}/exports?key={key}&token={token}' --data 'attachments=false'
this starts an export and gives me the same output as in their example. then I go to step 2. I use this request just like they say in their directions
curl https://trello.com/1/organizations/{orgIdOrName}/exports/{exportId}?key={key}&token={token}
but instead of getting the same output as them I get a message that says
can't read the state of an export
then when I press enter I get
[1] random number
Done "then a bunch of empty space" + my original request in step 2 minus the token
has anyone else ever had this issue? I can't seem to find it anywhere
figured it out. they're missing the apostrophes around the url in step 2. it should be
curl 'https://trello.com/1/organizations/{orgIdOrName}/exports/{exportId}?key={key}&token={token}'
How can I get specific field of some log message using gcloud?
I am currently using this command:
gcloud logging read "logName=projects/some_project/logs/stdout AND resource.type:k8s_container and resource.labels.cluster_name=testing AND resource.labels.namespace_name=test" --limit 10 --format json
I'm guessing this should be something related to SELECT (as read in gcloud's standard sql guide for bigquery: https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax)
OK so this seems to do the trick: --format="value(textPayload)"
I am new to elasticsearch and trying to find a way to create a document from url(http-API). I have tried below given options but none of them worked.
http://Myserver:9200/dilbert/user/3 -d '{ "name" : "Praveena" }
http://Myserver:9200/dilbert/user/3{ "name" : "Praveena" }
http://Myserver:9200/dilbert/user/3?pretty _create name=Praveena
I expect this to add a record. Here dilbert is Index name. user is type & 3 is id. This index only contains a single element called name.
First option should work, but you must explicitly set request type to PUT.
It seems to me that you use curl to insert data. If you send data to server with -d option, curl issues the POST request by default. But you specify id of document in URL, so Elasticsearch waits for PUT request (see official documentation). You can use POST requests only in case of automatic ID generation.
So your request may look as follows:
curl -X PUT http://Myserver:9200/dilbert/user/3 -d '{ "name" : "Praveena" }'
I have configured Graphite to monitor my application metrics. And I configured Zabbix to monitor my servers CPU and other metrics.
Now I want to pass some critical Graphite metrics to Zabbix to add triggers for them.
So I want to do something like
$ whisper get prefix1.prefix2.metricName
> 155
Is it possible?
P.S. I know about Graphite-API project, I don't want to install extra app.
You can use the whisper-fetch program which is provided in the whisper installation package.
Use it like this:
whisper-fetch /path/to/dot.wsp
Or to get e.g. data from the last 5 minutes:
whisper-fetch --from=$(date +%s -d "-5 min") /path/to/dot.wsp
Defaults will result in output like this:
1482318960 21.187000
1482319020 None
1482319080 21.187000
1482319140 None
1482319200 21.187000
You can change it to json using the --json option.
OK! I found it myself: http://graphite.readthedocs.io/en/latest/render_api.html?highlight=rawJson (I can use curl and return csv or json).
Answer was found here custom querying in graphite
Also see: https://github.com/graphite-project/graphite-web/blob/master/docs/render_api.rst
Im currently trying to get Parse's geo-query system to work. On my data browser, I have an installation with a key "location" of type geo-point that has a geo-point with latitude 30.27263636013176 and longitude -97.75766807716373 set in it.
However, if I try to query with the following code, I always get "results":[].
curl -X GET \
-H "X-Parse-Application-Id: myAppKey" \
-H "X-Parse-REST-API-Key: myAPIKey" \
-G \ --data-urlencode 'limit=10' \
--data-urlencode 'where={
"location": {
"$nearSphere": {
"__type": "GeoPoint",
"latitude": 30,
"longitude": -97
}
}
}' \
https://api.parse.com/1/classes/PlaceObject
Note that the query is running successfully; there are no errors. The problem is the installation I have should come up.
If I change the latitude and longitude in the query to exactly the latitude and longitude shown in the data browser, I still get empty results. What is the reason for this? Is it not possible to query for device installations near a point?
The Installation class can't be queried from the client, for good reason. Too much sensitive information is stored in the Installation class to allow querying from a client.
Either move the location property to another class you can query, or query it in a Cloud Function.
You can query it in Cloud Code if you use Parse.Cloud.useMasterKey();, though I strongly recommend using a different class to store the location.
Should the url be https://api.parse.com/1/classes/Installation instead of https://api.parse.com/1/classes/PlaceObject ?