I just need to know if there is an option to use replace with conversion
pattern for example:

%replace{%msg}{LOGLEVEL}{%level}


‫בתאריך יום ג׳, 13 באוק׳ 2020 ב-8:18 מאת ‪Ralph Goers‬‏ <‪
ralph.go...@dslextreme.com‬‏>:‬

> OK. What is the format?
>
> Ralph
>
> > On Oct 12, 2020, at 10:00 PM, ⁨רפי⁩ <⁨rafr...@gmail.com⁩> wrote:
> >
> > I don't have control on the elastic system and it is configured to get
> the
> > data as log files not json.
> > My team is responsible for several components and there are other teams
> > that are responsible for other components.
> > In addition there is an analytics team that is responsible for the
> elastic
> > stack system. They ask all teams to align the components logs to
> predefined
> > format in order to parse all logs in the same way.
> > So unfortunately, I can't use json. I just must order my fields in the
> > correct order as I asked to.
> >
> > ‫בתאריך יום ב׳, 12 באוק׳ 2020 ב-23:03 מאת ‪Ralph Goers‬‏ <‪
> > ralph.go...@dslextreme.com‬‏>:‬
> >
> >> If you are sending to Elastic why not use JSON?  See
> >> http://logging.apache.org/log4j/2.x/manual/cloud.html <
> >> http://logging.apache.org/log4j/2.x/manual/cloud.html>.
> >>
> >> Ralph
> >>
> >>> On Oct 12, 2020, at 11:49 AM, ⁨רפי⁩ <⁨rafr...@gmail.com⁩> wrote:
> >>>
> >>> I tried it and it didn't work. It just print the following text -
> >>> "%replace${event:Level}"
> >>>
> >>> I need it since I must put the log level after the "action" field. This
> >> is
> >>> needed for other system (elastic stack system) of log analysis.
> >>> The problem is that the action field is not available for me in
> >> log4j2.xml,
> >>> but only in some specific file. On the other hand the log level is not
> >>> available for me in the same file where the action field is available.
> >>> So of course I can change the code. But I prefer to fix it with
> >>> configuration and I thought that I can fix it by using log4j2.xml.
> >>>
> >>>
> >>> ‫בתאריך יום ב׳, 12 באוק׳ 2020 ב-21:36 מאת ‪Ralph Goers‬‏ <‪
> >>> ralph.go...@dslextreme.com‬‏>:‬
> >>>
> >>>> Possibly something like that. As I said, I haven’t had a chance to
> >>>> investigate it so I am not sure if interpolation is supported in that
> >> exact
> >>>> usage.
> >>>>
> >>>> I do wonder why you need to do it this way though.
> >>>>
> >>>> Ralph
> >>>>
> >>>>> On Oct 12, 2020, at 9:31 AM, ⁨רפי⁩ <⁨rafr...@gmail.com⁩> wrote:
> >>>>>
> >>>>> I will try it.
> >>>>> Do you mean that I will use the following:
> >>>>>
> >>>>> %replace{%msg}{LOGLEVEL}$${event:Level}
> >>>>>
> >>>>> ?
> >>>>>
> >>>>>
> >>>>> ‫בתאריך יום ב׳, 12 באוק׳ 2020 ב-18:35 מאת ‪Ralph Goers‬‏ <‪
> >>>>> ralph.go...@dslextreme.com‬‏>:‬
> >>>>>
> >>>>>> I suspect that using $${event:Level} could be made to work but I
> would
> >>>>>> have to try it to see what it would take and right now I have been
> >>>>>> extremely busy with the $dayjob$.
> >>>>>>
> >>>>>> Ralph
> >>>>>>
> >>>>>>> On Oct 12, 2020, at 2:56 AM, ⁨רפי⁩ <⁨rafr...@gmail.com⁩> wrote:
> >>>>>>>
> >>>>>>> In log4j2 configured by log4j2.xml - how can I replace some text
> with
> >>>>>>> other conversion
> >>>>>>> pattern?
> >>>>>>>
> >>>>>>>
> >>>>>>> For example, I have some message with the word "LOGLEVEL" and I
> want
> >> to
> >>>>>>> replace it with the current log level
> (WARN/DEBUG/ERROR/TRACE/INFO).
> >>>> The
> >>>>>>> conversion pattern
> >>>>>>> <https://logging.apache.org/log4j/2.x/manual/layouts.html> for the
> >> log
> >>>>>>> level is %p or %level, so I tried this:
> >>>>>>>
> >>>>>>> %replace{%msg}{LOGLEVEL}{%level}
> >>>>>>>
> >>>>>>> But instead of replacing the "LOGLEVEL" text with the actual
> *level*
> >> it
> >>>>>>> just replaced it with the text "%level".
> >>>>>>>
> >>>>>>> *The original message was*: this trace is LOGLEVEL log
> >>>>>>>
> >>>>>>> *For INFO trace I want to get*: this trace is INFO log
> >>>>>>>
> >>>>>>> *But I actually got*: this trace is %level log
> >>>>>>>
> >>>>>>> How can I achieve this requirement?
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> I asked it on StackOverflow but no one knows the answer.
> >>>>>>>
> >>>>>>>
> >>>>>>
> >>>>
> >>
> https://stackoverflow.com/questions/64305649/log4j2-replace-some-text-with-other-log4j2-conversion-pattern-with-level-for
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> Thanks,
> >>>>>>>
> >>>>>>> Refael
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> ---------------------------------------------------------------------
> >>>>>> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> >>>>>> For additional commands, e-mail: log4j-user-h...@logging.apache.org
> >>>>>>
> >>>>>>
> >>>>
> >>>>
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> >>>> For additional commands, e-mail: log4j-user-h...@logging.apache.org
> >>>>
> >>>>
> >>
> >>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>
>

Reply via email to