I am not able to execute the following aws cli command - linux

I am trying to execute the below command but I am getting an error can anyone please help
aws --profile awsprofile logs put-log-events --log-group-name mylogs --log-stream-name 20150601 --log-events file:///var/log/kafka/server.log.2016-09-25-02
Error:-
Expecting ',' delimiter or ']': line 1 column 6 (char 5)
So I determine the problem is with file:///
I want to specify /var/log/kafka/server.log.2016-09-25-02
as when I specify var/log/kafka/server.log.2016-09-25-02 it is saying file not found so I want to specify /var/log/kafka/server.log.2016-09-25-02. But when I specify in that way it is showing error as
Expecting ',' delimiter or ']': line 1 column 6 (char 5)
So please help me. Help will be appreciated.

The problem is not with the CLI command line, but in your log_events file /var/log/kafka/server.log.2016-09-25-02. It is not a valid JSON file.
Take a look at: put-log-event example

Put " or ' around file:///var/log/kafka/server.log.2016-09-25-02

Related

How can I execute a cat command in a execlp in C?

I'm trying to execute commands that are passed from the terminal to argv seperated by : to be more specific cat nevermind : grep left : wc -c.
tabCommand is an array that contains each command so cat nevermind,grep left,wc -c
With printf I can confirm that tabCommand[i-1] is indead equal to cat nevermind but the output I get is Error: No such file or directory
if (execl(tabCommande[i-1],tabCommande[i-1], (char *)NULL) == -1) {
error_and_exit();
}
If someone can help me find the issue I would really appreciate it.
With the comments I got in my post I managed to find my problem
execlp("/bin/sh","sh","-c",tabCommande[i], (char *)NULL) works because I need to use the full path.
If I do execlp(tabCommande[i],tabCommande[i], (char *)NULL) it won't work because im not using the full path of each command so simply giving cat to execlp won't work.
found this answer thanks to waltinator I'm new to stack so i dont know how to give you the credit

Error appending record to a file using echo

I want to write a record using execute command stage in Datastage sequence job.
I am using below syntax.
echo "InputFileName;2021-03-25 06:54:58+01:00;AAA;Batch;FOP;FUNCTIONAL;INFO;Extra key columns sent in Key Values;201;OK;SubmitRequest;ERROR;CDIER0961E: The REST step is unable to invoke the REST service, cause=javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated;;SupplyOnhand_20210325065458;;;;0;CDIER0961E: The REST step is unable to invoke the REST service, cause=javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated;;;;12;1;2021-03-25 05:55:18+00:00;2021-03-25 05:55:33+00:00" >> Filename
Below is error I am getting.
Output from command ====>
sh: -c: line 0: syntax error near unexpected token (' sh: -c: line 0: echo Unhandled failure (-1) encountered executing command echo
I tried running this manually on linux server its working there but failing in Datastage job.
Can someone please help.
You need to escape any character that is significant to the shell, or to contain the whole string in hard (single) quotes rather than soft (double) quotes.

yaml syntax error for ansible base64 multi line variable

Ansible Version: 2.1.2.0
So I have a yaml file with a multi line variable that's from a binary file converted to base 64.
My variable file: self-cert.yml
selfcert: |
MIIKCAIBAzCCCcIGCSqGSIb3DQEHAaCCCbMEggmvMIIJqzCCBWgGCSqGSIb3DQEHAaCCBVkEggVV
MIIFUTCCBU0GCyqGSIb3DQEMCgECoIIE+jCCBPYwKAYKKoZIhvcNAQwBAzAaBBQFa98IY7UgblDK
qGwMjTIQCK+3DwICBAAEggTIvA/VFm3j3oSN6cknp5qFyUxXAI5TxURnyx8UVRm8UfMcA0LHlh+z
06ztcwApIrxMSV26ezu0p1FrHInpbABNuO0rlk4XlQwTkLynUyg58iBwK7IyV5SqT2UC8djaOiMN
b9ViC3yn7SrRdS3MmCQznu6dScRIHbhG46yZNJrzrJh038X2KAPpS/LfC9DJBjaEzkZY8BwyARYe
When I try to run my playbook that includes this variable, I get:
ERROR! Syntax Error while loading YAML.
The error appears to have been in '/home/ansible/projects/install-cert/self-cert.yml': line 3, column 1, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
MIIKCAIBAzCCCcIGCSqGSIb3DQEHAaCCCbMEggmvMIIJqzCCBWgGCSqGSIb3DQEHAaCCBVkEggVV
MIIFUTCCBU0GCyqGSIb3DQEMCgECoIIE+jCCBPYwKAYKKoZIhvcNAQwBAzAaBBQFa98IY7UgblDK
^ here
Any idea whats wrong? I've tried changing | to > , didn't work, and i've also tried indenting the whole base64 output too.
So it turns out you do need to make an indentation to the the multiline variable. My original indentation was an actual tab instead of spaces (Stupid Sublime) and so the indentation failed the syntax check, but using actual spaces made everything work.

Error: Expected one of #, input, filter, output at line 24, column 1 (byte 528) after "}

I am able to run logstash as:
bin/logstash -f /etc/logstash/conf.d/config.json
but running logstash as a service
sudo service logstash start
is giving me the following error:
... Error: Expected one of #, input, filter, output at line 24, column 1 (byte 528) after "}
Not sure what I am doing wrong here? Configtest also says the config file is fine.
bin/logstash -f /etc/logstash/conf.d/config.json --configtest
Configuration OK
Any help is appreciated.
Thanks.
When logstash runs, it combines all the files in your config directory into one file. When there's an error, you're getting line and position information into that merged config.
Try:
cat /etc/logstash/conf.d/* > /tmp/total.conf
and then look at line 24 or 25 there.
FYI mine complains about line about line 163 and my combined files don't get that far.
Here someone had left an ~.vimrc file in the conf.d directory, which was then appended to the big configuration file.
--configtest probably ignores the file, but reading configs did not.

Linux bat file command line arguments:unexpected EOF while looking for matching `"'

i am running a bat file in linux as following .
java -cp ../lib/qautils.jar:../lib/Log4jWrapper1.2.jar:../lib/log4j-1.2.15.jar:../lib/jaa.jar com.pcube.qa.jaa.server.JAAServer -appdir /home/alpha/jaa/bin"
but if i run above getting following error:
./runjaa.bat: line 1: unexpected EOF while looking for matching `"'
./runjaa.bat: line 2: syntax error: unexpected end of file
Will anyone suggest me , where i am doing mistake.
If i delete " at the end , saying the directiory ,/home/alpha/jaa/bin does not exists.
Assuming that what you posted is accurate, you have a trailing " on that line that doesn't match up with another quotation mark. A quotation mark opens a quoted string, so your shell is looking for the closing quote.
You don't need the quote in this example, so just remove it.

Resources