[ 
https://issues.apache.org/jira/browse/TS-2364?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Yunkai Zhang updated TS-2364:
-----------------------------

    Description: 
Now, we have two kind of field syntax in log format:
{code}
(1) simple; syntax: '%<field>', for example: %<cqu>
(2) container field,  syntax '%<{container}field>', for example: 
%<{Referer}cqh>.
{code}

I'm going to introduce slice notation, so that we can easy to limit the length 
of filed's output. With slice notation, the filed syntax will looks like:
{code}
'%<{container}field[start:end]>'
{code}

But with one limitation: slice notation makes sense only when the field is 
string type. 

We can see the syntax of slice notation from Python, Golang, it's pretty simple:
{code}
field[start:end] # items start through end-1
field[start:]    # items start through the rest of the array
field[:end]      # items from the beginning through end-1
field[:]         # the whole array(by default)
{code}

For example, {code}'%<cqh[0:30]>'{code} means the first 30 characters of <cqh>.

  was:
Now, we have two kind of field syntax in log format:
{code}
(1) simple; syntax: '%<container>', for example: %<cqu>
(2) container field,  syntax '%<{field}container>', for example: 
%<{Referer}cqh>.
{code}

I'm going to introduce slice notation, so that we can easy to limit the length 
of filed's output. With slice notation, the filed syntax will looks like:
{code}
'%<{field}container[start:end]>'
{code}

But with one limitation: slice notation makes sense only when the container is 
string type. 

We can see the syntax of slice notation from Python, Golang, it's pretty simple:
{code}
a[start:end] # items start through end-1
a[start:]    # items start through the rest of the array
a[:end]      # items from the beginning through end-1
a[:]         # the whole array(by default)
{code}

For example, '%<cqh[0:30]>' means the first 30 characters of <cqh>.


> Introduce slice notation to field syntax in log format
> ------------------------------------------------------
>
>                 Key: TS-2364
>                 URL: https://issues.apache.org/jira/browse/TS-2364
>             Project: Traffic Server
>          Issue Type: Improvement
>          Components: Logging
>            Reporter: Yunkai Zhang
>            Assignee: Yunkai Zhang
>
> Now, we have two kind of field syntax in log format:
> {code}
> (1) simple; syntax: '%<field>', for example: %<cqu>
> (2) container field,  syntax '%<{container}field>', for example: 
> %<{Referer}cqh>.
> {code}
> I'm going to introduce slice notation, so that we can easy to limit the 
> length of filed's output. With slice notation, the filed syntax will looks 
> like:
> {code}
> '%<{container}field[start:end]>'
> {code}
> But with one limitation: slice notation makes sense only when the field is 
> string type. 
> We can see the syntax of slice notation from Python, Golang, it's pretty 
> simple:
> {code}
> field[start:end] # items start through end-1
> field[start:]    # items start through the rest of the array
> field[:end]      # items from the beginning through end-1
> field[:]         # the whole array(by default)
> {code}
> For example, {code}'%<cqh[0:30]>'{code} means the first 30 characters of 
> <cqh>.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to