Syslog-ng log template \\011 character - syslog-ng

I have a problem with syslog-ng. I want to make syslog-ng to format the logs like below:
template("$YEAR-$MONTH-$DAY\\011$HOUR:$MIN:$SEC\\011$HOST\\011$MSGHDR$MSGONLY\n")
But it logs without the "\". Just "011".
Example:
Expected: 2012-11-28\\01116:33:51\\011host_name\\011app_name[26250]:
message
Happened: 2012-11-2801116:33:51011host_name011app_name[26250]:
message
How to achieve this? Any ideas? :)
Thanks in advance ;)

The template function appears to accept escaped characters, so you would need to add an extra \ for each one:
template("$YEAR-$MONTH-$DAY\\\\011$HOUR:$MIN:$SEC\\\\011$HOST\\\\011$MSGHDR$MSGONLY\n")

Related

SQL REGEXP_CONTAINS with dot - Google BigQuery

Working on Google BigQuery, kinda newbie.
I'm trying to capture if in a field there a string like "LS" or "L.S".
So far i've written this piece of code:
IF (REGEXP_CONTAINS(subfamilia_ds, "LS") = true OR REGEXP_CONTAINS(subfamilia_ds, "L.S") = true,true,false) = true THEN "LS"
However, for some reason that goes beyond my SQL knowledge, it's returning values such as "OUTROS MOLUSCOS BALCAO" that as neither "LS" nor "L.S".
I'm really struggling with this, and maybe it's a "dumb" issue.
Thank you in advance for the help!
The regex pattern you want to match LS or L.S is either L\.?S or L[.]?S. The middle dot is optional, and also it is a regex metacharacter which has a special meaning of any single character, and hence it must be escaped to mean a literal dot. Try this updated version:
IF (REGEXP_CONTAINS(subfamilia_ds, "L\\.?S") = true) THEN "LS"

curl: no matches found

trying to hit a public endpoint that works in the browser(gives json response), But does not in curl.
curl https://yts.lt/api/v2/list_movies.json?query_term=tt11296058
It gives the following message
no matches found: https://yts.lt/api/v2/list_movies.json?query_term=tt11296058
Not sure what could be the issue here, any input would be appreciated.
It may be due to do with what shell you are using. Try wrapping the URL in single or double quotes as suggested here.
Here is the quote from the above link discussing ZSH.
You need to escape the question mark, otherwise zsh thinks it is a globbing or wildcard character and tries to find files that match it (that's why it says no matches found).

BigQuery - Illegal Escape Sequence

I'm having an issue matching regular expression in BigQuery. I have the following line of code that tries to identify user agents:
when regexp_contains((cs_user_agent), '^AppleCoreMedia\/1\.(.*)iPod') then "iOS App - iPod"
However, BigQuery doesn't seem to like escape sequences for some reason and I get this error that I can't figure out:
Syntax error: Illegal escape sequence: \/ at [4:63]
This code works fine in a regex validator I use, but BigQuery is unhappy with it and I can't figure out why. Thanks in advance for the help
Use regexp_contains((cs_user_agent), r'^AppleCoreMedia\/1\.(.*)iPod')

Find and replace with variable

In webstorm 2017.1.1 I would like to find and replace a simple string with variable in the replace, for example:
find: testID:'
replace: testID:'${FILE_NAME}
And I expect the replace result will be testID:'MY_FILE_NAME...
Someone know if it's possible vie webstorm or via any plugin related?
Thanks in advance.
As #SupunWijerathne said, the IDEA replace dialogue is not aware of variables. However, this is something you could easily do in a shell. For example, on Linux, and with a replacement string without any special characters, you could do this:
sed -i "s/testID:'/testID:'${FILE_NAME}/g" my-file.txt

Special Characters in Apache Velocity

How do I get Special Characters to show up in Apache Velocity as a string?
something like:
#include(" <Bundle>")
#include(" <Description>$!{bundle.description}</Description>")
#include(" </Bundle>")
you can use velocity escape tool.
https://velocity.apache.org/tools/devel/generic/EscapeTool.html
I took out the includes and it wrote it all as I needed it.